JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.util.swing
Class JCAlignLayout

java.lang.Object
  |
  +--java.awt.GridLayout
        |
        +--com.klg.jclass.util.swing.JCGridLayout
              |
              +--com.klg.jclass.util.swing.JCAlignLayout
All Implemented Interfaces:
LayoutManager, Serializable

public class JCAlignLayout
extends JCGridLayout

A layout that provides a simple way to lay out a vertically arranged group of control components, each with an associated label (or other component) placed to its left.

Properties

Name Method
LabelDefaultAlignment setLabelDefaultAlignment
LabelVerticalAlignment setLabelVerticalAlignment
ResizeHeight setResizeHeight
ResizeWidth setResizeWidth

See Also:
Serialized Form

Field Summary
protected  Hashtable alignment
           
static int BOTTOM
           
static int MIDDLE
           
protected  Hashtable resize_height
           
protected  Hashtable resize_width
           
static int TOP
           
 
Fields inherited from class com.klg.jclass.util.swing.JCGridLayout
col_widths, cols, hgap, row_heights, rows, VARIABLE, vgap
 
Constructor Summary
JCAlignLayout()
          Creates an aligner layout with 2 columns, a variable number of rows, and a gap of 5 pixels.
JCAlignLayout(int cols, int hgap, int vgap)
          Creates an aligner layout with the specified number of columns and gaps.
 
Method Summary
 int getLabelVerticalAlignment(Component child)
          Gets the vertical position of a label relative to its control.
 boolean getResizeHeight(Component child)
          Gets the component's RezizeHeight value.
 boolean getResizeWidth(Component child)
          Gets the component's RezizeWidth value.
protected  boolean isLabel(int col)
           
protected  void setBounds(int pos, int row, int col, Component comp, int x, int y, int col_width, int row_height)
          Positions the component.
 void setLabelVerticalAlignment(Component child, int align)
          Sets the vertical position of a label relative to its control.
 void setResizeHeight(Component child, boolean v)
          Sets whether the control should be resized vertically to the height of the largest component in its row (default is false).
 void setResizeWidth(Component child, boolean v)
          Sets whether the control should be resized horizontally to its parent's right edge if it is in the last column (default is false).
 
Methods inherited from class com.klg.jclass.util.swing.JCGridLayout
getGridSizes, layoutContainer, minimumLayoutSize, preferredLayoutSize
 
Methods inherited from class java.awt.GridLayout
addLayoutComponent, getColumns, getHgap, getRows, getVgap, removeLayoutComponent, setColumns, setHgap, setRows, setVgap, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TOP

public static final int TOP
See Also:
Constant Field Values

MIDDLE

public static final int MIDDLE
See Also:
Constant Field Values

BOTTOM

public static final int BOTTOM
See Also:
Constant Field Values

alignment

protected Hashtable alignment

resize_width

protected Hashtable resize_width

resize_height

protected Hashtable resize_height
Constructor Detail

JCAlignLayout

public JCAlignLayout()
Creates an aligner layout with 2 columns, a variable number of rows, and a gap of 5 pixels.


JCAlignLayout

public JCAlignLayout(int cols,
                     int hgap,
                     int vgap)
Creates an aligner layout with the specified number of columns and gaps.

Parameters:
cols - the number of columns (should be a multiple of 2)
hgap - the horizontal gap variable
vgap - the vertical gap variable
Throws:
IllegalArgumentException - If the rows and columns are invalid.
Method Detail

getLabelVerticalAlignment

public int getLabelVerticalAlignment(Component child)
Gets the vertical position of a label relative to its control.

Parameters:
child -
Returns:
vertical position of a label
See Also:
setLabelVerticalAlignment(java.awt.Component, int)

setLabelVerticalAlignment

public void setLabelVerticalAlignment(Component child,
                                      int align)
Sets the vertical position of a label relative to its control.

Parameters:
align - TOP, MIDDLE (default), or BOTTOM
child -
Throws:
IllegalArgumentException - If an invalid value is set.

getResizeWidth

public boolean getResizeWidth(Component child)
Gets the component's RezizeWidth value.

Parameters:
child -
Returns:
See Also:
setResizeWidth(java.awt.Component, boolean)

setResizeWidth

public void setResizeWidth(Component child,
                           boolean v)
Sets whether the control should be resized horizontally to its parent's right edge if it is in the last column (default is false).

Parameters:
child -
v -

getResizeHeight

public boolean getResizeHeight(Component child)
Gets the component's RezizeHeight value.

Parameters:
child -
Returns:
See Also:
setResizeHeight(java.awt.Component, boolean)

setResizeHeight

public void setResizeHeight(Component child,
                            boolean v)
Sets whether the control should be resized vertically to the height of the largest component in its row (default is false). This value is ignored for labels (the components in odd columns).

Parameters:
child -
v -

isLabel

protected boolean isLabel(int col)

setBounds

protected void setBounds(int pos,
                         int row,
                         int col,
                         Component comp,
                         int x,
                         int y,
                         int col_width,
                         int row_height)
Positions the component.

Overrides:
setBounds in class JCGridLayout
Parameters:
pos - the component's index in its parents child list
row - component's position
col - component's position
col_width -
comp -
row_height -
x -
y -

Copyright © 2004 Quest Software Inc..
All rights reserved.