All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jclass.bwt.JCGridLayout

java.lang.Object
   |
   +----java.awt.GridLayout
           |
           +----jclass.bwt.JCGridLayout

public class JCGridLayout
extends GridLayout
JCGridLayout is an improved subclass of GridLayout. It lays out a grid of rows and columns based on the attributes of the individual rows and columns. Whereas GridLayout uses the widest and tallest child to size each cell, JCGridLayout uses the widest element in a column to set the width of that column, and the tallest element in a row to set the height of that row.


Variable Index

 o col_widths
Array of column widths.
 o cols
The number of columns in the layout, as set by the user.
 o hgap
The horiztonal gap between items.
 o row_heights
Array of row heights.
 o rows
The number of rows in the layout, as set by the user.
 o VARIABLE
 o vgap
The vertical gap between items.

Constructor Index

 o JCGridLayout(int, int)
Creates a grid layout with the specified number of rows and columns.
 o JCGridLayout(int, int, int, int)
Creates a grid layout with the specified rows, columns, horizontal gap, and vertical gap.

Method Index

 o getGridSizes(Container, boolean)
Traverses the children and determines row heights and column widths.
 o layoutContainer(Container)
Performs the layout of the children.
 o minimumLayoutSize(Container)
Returns the minimum dimensions needed to layout the components contained in the specified panel.
 o preferredLayoutSize(Container)
Calculates the preferred size for this layout.
 o reshape(int, int, int, Component, int, int, int, int)
Positions the component.

Variables

 o hgap
 protected int hgap
The horiztonal gap between items.

 o vgap
 protected int vgap
The vertical gap between items.

 o rows
 protected int rows
The number of rows in the layout, as set by the user. This number may not correspond exactly to the number of rows in the layout.

 o cols
 protected int cols
The number of columns in the layout, as set by the user. This number may not correspond exactly to the number of columns in the layout.

 o row_heights
 protected int row_heights[]
Array of row heights. It is accurate only after a call to getGridSizes()

 o col_widths
 protected int col_widths[]
Array of column widths. It is accurate only after a call to getGridSizes()

 o VARIABLE
 public static final int VARIABLE

Constructors

 o JCGridLayout
 public JCGridLayout(int rows,
                     int cols)
Creates a grid layout with the specified number of rows and columns.

Parameters:
rows - the number of rows in the layout
cols - the number of columns in the layout
 o JCGridLayout
 public JCGridLayout(int rows,
                     int cols,
                     int hgap,
                     int vgap)
Creates a grid layout with the specified rows, columns, horizontal gap, and vertical gap.

Parameters:
rows - the rows; VARIABLE (0) means 'any number.'
cols - the columns; VARIABLE (0) means 'any number.' Only one of 'rows' and 'cols' can be VARIABLE, not both.
hgap - the horizontal gap variable
vgap - the vertical gap variable
Throws: IllegalArgumentException
If the rows and columns are invalid.

Methods

 o getGridSizes
 protected void getGridSizes(Container parent,
                             boolean min)
Traverses the children and determines row heights and column widths.

Parameters:
parent - the component which needs to be laid out
min - if true, the minimum size is used. Otherwise, the preferred size is used.
 o preferredLayoutSize
 public Dimension preferredLayoutSize(Container parent)
Calculates the preferred size for this layout.

Parameters:
parent - the component which needs to be laid out
Overrides:
preferredLayoutSize in class GridLayout
 o minimumLayoutSize
 public Dimension minimumLayoutSize(Container parent)
Returns the minimum dimensions needed to layout the components contained in the specified panel.

Parameters:
parent - the component which needs to be laid out
Overrides:
minimumLayoutSize in class GridLayout
 o reshape
 protected void reshape(int pos,
                        int row,
                        int col,
                        Component comp,
                        int x,
                        int y,
                        int w,
                        int h)
Positions the component.

Parameters:
pos - the component's index in its parents child list
row,col - component's position
 o layoutContainer
 public void layoutContainer(Container parent)
Performs the layout of the children. It calculates the number of actual rows and columns based on the user's settings, retrieves row height and column width information, then moves all the children to the appropriate places.

Parameters:
parent - the specified component being laid out
Overrides:
layoutContainer in class GridLayout
See Also:
reshape

All Packages  Class Hierarchy  This Package  Previous  Next  Index