acm.gui
Class TablePanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by acm.gui.TablePanel
Direct Known Subclasses:
HPanel, VPanel

public class TablePanel
extends JPanel

This class represents a simple JPanel that uses TableLayout as its layout manager. The purpose of TablePanel is to support tabular component structures without the complexity of the GridBagLayout class.


 

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
TablePanel(int rows, int columns)
Creates a new TablePanel whose layout manager supports the specified number of rows and columns.
TablePanel(int rows, int columns, int hgap, int vgap)
Creates a new TablePanel with the specified number of rows and columns and the supplied values for the horizontal and vertical gap.
 
Method Summary
 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 getVerticalAlignment()
Returns the vertical alignment for the table.
 int getVgap()
Returns the vertical gap between components.
 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 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

See Also:
Constant Field Values

public static final int BOTTOM

Align table vertically at the bottom of its container

See Also:
Constant Field Values

public static final int CENTER

Center table in the container

See Also:
Constant Field Values

public static final int FILL

Expand table to fill its container

See Also:
Constant Field Values

public static final int HORIZONTAL

Resize component in horizontal direction only

See Also:
Constant Field Values

public static final int LEFT

Align table horizontally at the left of its container

See Also:
Constant Field Values

public static final int NONE

Do not resize component

See Also:
Constant Field Values

public static final int RIGHT

Align table horizontally at the right of its container

See Also:
Constant Field Values

public static final int TOP

Align table vertically at the top of its container

See Also:
Constant Field Values

public static final int VERTICAL

Resize component in vertical direction only

See Also:
Constant Field Values
Constructor Detail

public TablePanel(int rows, int columns)

Creates a new TablePanel whose layout manager supports the specified number of rows and columns.

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


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

Creates a new TablePanel with the specified number of rows and columns and the supplied values for the horizontal and vertical gap.

 
Usage: TablePanel panel = new TablePanel(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 gap between columns
vgap  The gap between rows
 

Method Detail

public int getDefaultFill()

Returns the default fill parameter for components in the table.

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


public int getHgap()

Returns the horizontal gap between components.

 
Returns: The horizontal gap between components
 


public int getHorizontalAlignment()

Returns the horizontal alignment for the table.

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


public int getVerticalAlignment()

Returns the vertical alignment for the table.

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


public int getVgap()

Returns the vertical gap between components.

 
Returns: The vertical gap between components
 


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.

 
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 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.

 
Parameter: 
pixels  The gap between components in pixels