All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.awt.GridLayout

java.lang.Object
   |
   +----java.awt.GridLayout

public class GridLayout
extends Object
implements LayoutManager, Serializable
A layout manager for a container that lays out grids.


Constructor Index

 o GridLayout()
Creates a grid layout with a default of one column per component, in a single row.
 o GridLayout(int, int)
Creates a grid layout with the specified rows and columns.
 o GridLayout(int, int, int, int)
Creates a grid layout with the specified rows, columns, horizontal gap, and vertical gap.

Method Index

 o addLayoutComponent(String, Component)
Adds the specified component with the specified name to the layout.
 o getColumns()
Returns the number of columns in this layout.
 o getHgap()
Returns the horizontal gap between components.
 o getRows()
Returns the number of rows in this layout.
 o getVgap()
Returns the vertical gap between components.
 o layoutContainer(Container)
Lays out the container in the specified panel.
 o minimumLayoutSize(Container)
Returns the minimum dimensions needed to layout the components contained in the specified panel.
 o preferredLayoutSize(Container)
Returns the preferred dimensions for this layout given the components int the specified panel.
 o removeLayoutComponent(Component)
Removes the specified component from the layout.
 o setColumns(int)
Sets the number of columns in this layout.
 o setHgap(int)
Sets the horizontal gap between components.
 o setRows(int)
Sets the number of rows in this layout.
 o setVgap(int)
Sets the vertical gap between components.
 o toString()
Returns the String representation of this GridLayout's values.

Constructors

 o GridLayout
 public GridLayout()
Creates a grid layout with a default of one column per component, in a single row.

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

Parameters:
rows - the rows
cols - the columns
 o GridLayout
 public GridLayout(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; zero means 'any number.'
cols - the columns; zero means 'any number.' Only one of 'rows' and 'cols' can be zero, not both.
hgap - the horizontal gap variable
vgap - the vertical gap variable
Throws: IllegalArgumentException
If the rows and columns are invalid.

Methods

 o getRows
 public int getRows()
Returns the number of rows in this layout.

 o setRows
 public void setRows(int rows)
Sets the number of rows in this layout.

Parameters:
rows - number of rows in this layout
 o getColumns
 public int getColumns()
Returns the number of columns in this layout.

 o setColumns
 public void setColumns(int cols)
Sets the number of columns in this layout.

Parameters:
cols - number of columns in this layout
 o getHgap
 public int getHgap()
Returns the horizontal gap between components.

 o setHgap
 public void setHgap(int hgap)
Sets the horizontal gap between components.

Parameters:
hgap - the horizontal gap between components
 o getVgap
 public int getVgap()
Returns the vertical gap between components.

 o setVgap
 public void setVgap(int vgap)
Sets the vertical gap between components.

Parameters:
vgap - the vertical gap between components
 o addLayoutComponent
 public void addLayoutComponent(String name,
                                Component comp)
Adds the specified component with the specified name to the layout.

Parameters:
name - the name of the component
comp - the component to be added
 o removeLayoutComponent
 public void removeLayoutComponent(Component comp)
Removes the specified component from the layout. Does not apply.

Parameters:
comp - the component to be removed
 o preferredLayoutSize
 public Dimension preferredLayoutSize(Container parent)
Returns the preferred dimensions for this layout given the components int the specified panel.

Parameters:
parent - the component which needs to be laid out
See Also:
minimumLayoutSize
 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
See Also:
preferredLayoutSize
 o layoutContainer
 public void layoutContainer(Container parent)
Lays out the container in the specified panel.

Parameters:
parent - the specified component being laid out
See Also:
Container
 o toString
 public String toString()
Returns the String representation of this GridLayout's values.

Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index

Submit a bug or feature