The GridBagLayout LayoutManager provides the means to layout components in a flexible grid-based display model.
public class java.awt.GridBagLayout extends java.lang.Object implements java.awt.LayoutManager2, java.io.Serializable { // Protected Constants protected static final MAXGRIDSIZE; protected static final MINSIZE; protected static final PREFERREDSIZE; // Variables public double columnWeights[]; public int columnWidths[]; public int rowHeights[]; public double rowWeights[]; // Protected Variables protected Hashtable comptable; protected GridBagConstraints defaultConstraints; protected GridBagLayoutInfo layoutInfo; // Constructors public GridBagLayout(); // Instance Methods public void addLayoutComponent (Component comp, Object constraints); public void addLayoutComponent (String name, Component component); public GridBagConstraints getConstraints (Component component); public abstract float getLayoutAlignmentX(Container target); public abstract float getLayoutAlignmentY(Container target); public int[][] getLayoutDimensions(); public Point getLayoutOrigin(); public double[][] getLayoutWeights(); public abstract void invalidateLayout(Container target); public void layoutContainer (Container target); public Point location (int x, int y); public abstract Dimension maximumLayoutSize(Container target); public Dimension minimumLayoutSize (Container target); public Dimension preferredLayoutSize (Container target); public void removeLayoutComponent (Component component); public void setConstraints (Component component, GridBagConstraints constraints); public String toString(); // Protected Instance Methods protected void AdjustForGravity (GridBagConstraints constraints, Rectangle r); protected void ArrangeGrid (Container target); protected GridBagLayoutInfo GetLayoutInfo (Container target, int sizeFlag); protected Dimension GetMinSize (Container target, GridBagLayoutInfo info); protected GridBagConstraints lookupConstraints (Component comp); }
Maximum number of rows and columns within container managed by GridBagLayout.
Used for internal sizing purposes.
Used for internal sizing purposes.
The weightx values of the components in the row with the most elements.
The width values of the components in the row with the most elements.
The height values of the components in the column with the most elements.
The weighty values of the components in the column with the most elements.
Internal table to manage components.
Constraints to use for Components that have none.
Internal information about the GridBagLayout.
Constructs a GridBagLayout object.
The component being added.
An object describing the constraints on this component.
LayoutManager2.addLayoutComponent()
Adds the component comp to container subject to the given constraints. This is a more generalized version of addLayoutComponent(String, Component). It corresponds to java.awt.Container's add(Component, Object).
Name of component to add.
Actual component being added.
LayoutManager.addLayoutComponent()
Does nothing.
Component whose constraints are desired
GridBagConstraints for component requested.
The container to inspect.
The value .5 for all containers.
This method returns the preferred alignment of the given container target. A return value of 0 is left aligned, .5 is centered, and 1 is right aligned.
The container to inspect.
The value .5 for all containers.
This method returns the preferred alignment of the given container target. A return value of 0 is top aligned, .5 is centered, and 1 is bottom aligned.
Returns two single dimension arrays as a multi-dimensional array. Index 0 is an array of widths (columnWidths instance variable), while index 1 is an array of heights (rowHeights instance variable).
Returns the origin of the components within the Container whose LayoutManager is GridBagLayout.
Returns two single dimension arrays as a multi-dimensional array. Index 0 is an array of columns weights (columnWeights instance variable), while index 1 is an array of row weights (rowWeights instance variable).
The container to invalidate.
Does nothing.
The container that needs to be redrawn.
LayoutManager.layoutContainer()
Draws components contained within target.
The x coordinate of the grid position to find.
The y coordinate of the grid position to find.
Returns the grid element under the location provided at position (x, y) in pixels. Note that the returned Point uses the GridBagLayout's grid for its coordinate space.
Locates the grid position in the Container under the given location.
The container to inspect.
A Dimension whose horizontal and vertical components are Integer.MAX_VALUE.
For GridBagLayout, a maximal Dimension is always returned.
The container whose size needs to be calculated.
Minimum Dimension of container target.
LayoutManager.minimumLayoutSize()
Calculates minimum size of target container.
The container whose size needs to be calculated.
Preferred Dimension of container target
LayoutManager.preferredLayoutSize()
Calculates preferred size of target container.
Component to stop tracking.
LayoutManager.removeLayoutComponent()
Does nothing.
Component to set constraints for
Constraints for component
Changes the GridBagConstraints on component to those provided.
A string representation of the GridBagLayout object.
Object.toString()
Constraints to use for adjustment of Rectangle.
Rectangular area that needs to be adjusted.
Helper routine for laying out a cell of the grid. The routine adjusts the values for r based upon the constraints.
Container to layout.
Helper routine that does the actual arrangement of components in target.
Container to get information about.
One of the constants MINSIZE or PREFERREDSIZE.
Returns an internal class used to help size the container.
Container to calculate size.
Specifics about the container's constraints.
Minimum Dimension of container target based on info.
Helper routine for calculating size of container.
Component in question.
A reference to the GridBagConstraints object for this component.
Helper routine for calculating size of container.
Component, Container, Dimension, GridBagConstraints, Hashtable, LayoutManager, LayoutManager2, Object, Point, Rectangle, String
This HTML Help has been published using the chm2web software. |