    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.

##

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

##

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

##

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

##

hgap

     protected int hgap

  The horiztonal gap between items.

vgap

     protected int vgap

  The vertical gap between items.

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.

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.

row_heights

     protected int row_heights[]

  Array of row heights. It is accurate only after a call to getGridSizes()

col_widths

     protected int col_widths[]

  Array of column widths. It is accurate only after a call to getGridSizes()

VARIABLE

     public static final int VARIABLE

##

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

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.

##

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.

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

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

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

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