acm.gui
Class TableLayout

java.lang.Object
  |
  +--acm.gui.TableLayout

public class TableLayout extends Object implements LayoutManager2


Field Summary
int BOTH
Resize component in both directions
int BOTTOM
Align table vertically at the bottom of its container
int CENTER
Center table in the container
int FILL
Expand table to fill its container
int HORIZONTAL
Resize component in horizontal direction only
int LEFT
Align table horizontally at the left of its container
int NONE
Do not resize component
int RIGHT
Align table horizontally at the right of its container
int TOP
Align table vertically at the top of its container
int VERTICAL
Resize component in vertical direction only
 
Constructor Summary
TableLayout()
Creates a new TableLayout object with no limits on the number of rows and columns.
TableLayout(int rows, int columns)
Creates a new TableLayout object with the specified number of rows and columns.
TableLayout(int rows, int columns, int hgap, int vgap)
Creates a new TableLayout object with the specified row count, column count, alignment, horizontal gap, and vertical gap.
 
Method Summary
int getColumnCount()
Returns the number of columns in the table.
TableConstraints getConstraints(Component comp)
Returns a copy of the constraints requested for the specified component.
int getDefaultFill()
Returns the default fill parameter for components in the table.
int getHgap()
Returns the horizontal gap between components.
int getHorizontalAlignment()
Returns the horizontal alignment for the table.
int getRowCount()
Returns the number of rows in the table.
int getVerticalAlignment()
Returns the vertical alignment for the table.
int getVgap()
Returns the vertical gap between components.
void setColumnCount(int columns)
Resets the number of columns in the table.
void setConstraints(Component comp, GridBagConstraints constraints)
Sets the constraints for the component to a copy of the supplied constraints.
void setConstraints(Component comp, String constraints)
Sets the constraints for the component to the constraints specified by the string.
void setDefaultFill(int fill)
Sets the default fill parameter for components in the table.
void setHgap(int pixels)
Sets the horizontal gap between components.
void setHorizontalAlignment(int align)
Sets the horizontal alignment for the table.
void setRowCount(int rows)
Resets the number of rows in the table.
void setVerticalAlignment(int align)
Sets the vertical alignment for the table.
void setVgap(int pixels)
Sets the vertical gap between components.
 

Field Detail

public static final int BOTH

Resize component in both directions

public static final int BOTTOM

Align table vertically at the bottom of its container

public static final int CENTER

Center table in the container

public static final int FILL

Expand table to fill its container

public static final int HORIZONTAL

Resize component in horizontal direction only

public static final int LEFT

Align table horizontally at the left of its container

public static final int NONE

Do not resize component

public static final int RIGHT

Align table horizontally at the right of its container

public static final int TOP

Align table vertically at the top of its container

public static final int VERTICAL

Resize component in vertical direction only
Constructor Detail

public TableLayout()

Creates a new TableLayout object with no limits on the number of rows and columns.

 
Usage: TableLayout layout = new TableLayout(); 
 

public TableLayout(int rows, int columns)

Creates a new TableLayout object with the specified number of rows and columns.

 
Usage: TableLayout layout = new TableLayout(rows, columns); 
Parameters: 
rows  The number of rows, or 0 for no limit
columns  The number of columns, or 0 for no limit
 

public TableLayout(int rows, int columns, int hgap, int vgap)

Creates a new TableLayout object with the specified row count, column count, alignment, horizontal gap, and vertical gap.

 
Usage: TableLayout layout = new TableLayout(rows, columns, hgap, vgap); 
Parameters: 
rows  The number of rows, or 0 for no limit
columns  The number of columns, or 0 for no limit
hgap  The horizontal gap between columns
vgap  The vertical gap between rows
 
Method Detail

public int getColumnCount()

Returns the number of columns in the table.

 
Usage: int columns = layout.getColumnCount(); 
Returns: The number of columns
 

public TableConstraints getConstraints(Component comp)

Returns a copy of the constraints requested for the specified component. The constraints value is always converted to a TableConstraints so that clients can use this class in preference to GridBagConstraints without needing a type cast.

 
Usage: TableConstraints tc = layout.getConstraints(comp); 
Parameter: 
comp  The component whose constraints are requested
Returns: A copy of the constraints object used to specify the layout
 

public int getDefaultFill()

Returns the default fill parameter for components in the table.

 
Usage: int fill = layout.getDefaultFill(); 
Returns: The default fill parameter for components in the table
 

public int getHgap()

Returns the horizontal gap between components.

 
Usage: int hgap = layout.getHgap(); 
Returns: The horizontal gap between components
 

public int getHorizontalAlignment()

Returns the horizontal alignment for the table.

 
Usage: int align = layout.getHorizontalAlignment(); 
Returns: The horizontal alignment for the table
 

public int getRowCount()

Returns the number of rows in the table.

 
Usage: int rows = layout.getRowCount(); 
Returns: The number of rows
 

public int getVerticalAlignment()

Returns the vertical alignment for the table.

 
Usage: int align = layout.getVerticalAlignment(); 
Returns: The vertical alignment for the table
 

public int getVgap()

Returns the vertical gap between components.

 
Usage: int vgap = layout.getVgap(); 
Returns: The vertical gap between components
 

public void setColumnCount(int columns)

Resets the number of columns in the table.

 
Usage: layout.setColumnCount(columns); 
Parameter: 
columns  The new number of columns
 

public void setConstraints(Component comp, GridBagConstraints constraints)

Sets the constraints for the component to a copy of the supplied constraints.

 
Usage: layout.setConstraints(comp, constraints); 
Parameters: 
comp  The component to be constrained
constraints  The constraints object used to specify the layout
 

public void setConstraints(Component comp, String constraints)

Sets the constraints for the component to the constraints specified by the string.

 
Usage: layout.setConstraints(comp, constraints); 
Parameters: 
comp  The component to be constrained
constraints  A string specifying the constraints
 

public void setDefaultFill(int fill)

Sets the default fill parameter for components in the table. The legal values are NONE, HORIZONTAL, VERTICAL, and BOTH.

 
Usage: layout.setDefaultFill(fill); 
Parameter: 
fill  The default fill parameter for components in the table
 

public void setHgap(int pixels)

Sets the horizontal gap between components.

 
Usage: layout.setHgap(pixels); 
Parameter: 
pixels  The gap between components in pixels
 

public void setHorizontalAlignment(int align)

Sets the horizontal alignment for the table. The legal values are CENTER, LEFT, RIGHT, and FILL.

 
Usage: layout.setHorizontalAlignment(align); 
Parameter: 
align  The horizontal alignment for the table
 

public void setRowCount(int rows)

Resets the number of rows in the table.

 
Usage: layout.setRowCount(rows); 
Parameter: 
rows  The new number of rows
 

public void setVerticalAlignment(int align)

Sets the vertical alignment for the table. The legal values are CENTER, TOP, BOTTOM, and FILL.

 
Usage: layout.setVerticalAlignment(align); 
Parameter: 
align  The vertical alignment for the table
 

public void setVgap(int pixels)

Sets the vertical gap between components.

 
Usage: layout.setVgap(pixels); 
Parameter: 
pixels  The gap between components in pixels