The GridLayout LayoutManager provides the means to layout components in a grid of rows and columns.
public class java.awt.GridLayout extends java.lang.Object implements java.awt.LayoutManager, java.io.Serializable { // Constructors public GridLayout(); public GridLayout (int rows, int cols); public GridLayout (int rows, int cols, int hgap, int vgap); // Instance Methods public void addLayoutComponent (String name, Component component); public int getColumns(); public int getHgap(); public int getRows(); public int getVgap(); public void layoutContainer (Container target); public Dimension minimumLayoutSize (Container target); public Dimension preferredLayoutSize (Container target); public void removeLayoutComponent (Component component); public int setColumns(int cols); public int setHgap(int hgap); public int setRows(int rows); public int setVgap(int vgap); public String toString(); }
Constructs a GridLayout object with a default single row and one column per component.
Requested number of rows in container.
Requested number of columns in container.
Constructs a GridLayout object with the requested number of rows and columns. Note that the actual number of rows and columns depends on the number of objects in the layout, not the constructor's parameters.
Requested number of rows in container.
Requested number of columns in container.
Horizontal space between each component in a row.
Vertical space between each row.
Constructs a GridLayout object with the requested number of rows and columns and the values specified as the gaps between each component. Note that the actual number of rows and columns depends on the number of objects in the layout, not the constructor's parameters.
Name of component to add.
Actual component being added.
LayoutManager.addLayoutComponent()
Does nothing.
The number of columns.
The horizontal gap for this GridLayout instance.
The number of rows.
The vertical gap for this GridLayout instance.
The container that needs to be redrawn.
LayoutManager.layoutContainer()
Draws the components contained within the target.
The container whose size needs to be calculated.
Minimum Dimension of the container target.
LayoutManager.minimumLayoutSize()
Calculates the minimum size of the target container.
The container whose size needs to be calculated.
Preferred Dimension of the container target.
LayoutManager.preferredLayoutSize()
Calculates the preferred size of the target container.
Component to stop tracking.
LayoutManager.removeLayoutComponent()
Does nothing.
The new number of columns.
Sets the number of columns.
The horizontal gap value.
Sets the horizontal gap between components.
The new number of rows.
Sets the number of rows.
The vertical gap value.
Sets the vertical gap between components.
A string representation of the GridLayout object.
Object.toString()
Component, Container, Dimension, LayoutManager, Object, String