Class java.awt.GridBagConstraints
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.awt.GridBagConstraints

Object
   |
   +----java.awt.GridBagConstraints

public class GridBagConstraints
extends Object
implements Cloneable, Serializable
The GridBagConstraints class specifies constraints for components that are laid out using the GridBagLayout class.

Version:
1.11, 07/01/98
Author:
Doug Stein
Since:
JDK1.0
See Also:
GridBagLayout

Variable Index

 o BOTH
Resize the component both horizontally and vertically.
 o CENTER
Put the component in the center of its display area.
 o EAST
Put the component on the right side of its display area, centered vertically.
 o HORIZONTAL
Resize the component horizontally but not vertically.
 o NONE
Do not resize the component.
 o NORTH
Put the component at the top of its display area, centered horizontally.
 o NORTHEAST
Put the component at the top-right corner of its display area.
 o NORTHWEST
Put the component at the top-left corner of its display area.
 o RELATIVE
Specify that this component is the next-to-last component in its column or row (gridwidth, gridheight), or that this component be placed next to the previously added component (gridx, gridy).
 o REMAINDER
Specify that this component is the last component in its column or row.
 o SOUTH
Put the component at the bottom of its display area, centered horizontally.
 o SOUTHEAST
Put the component at the bottom-right corner of its display area.
 o SOUTHWEST
Put the component at the bottom-left corner of its display area.
 o VERTICAL
Resize the component vertically but not horizontally.
 o WEST
Put the component on the left side of its display area, centered vertically.
 o anchor
This field is used when the component is smaller than its display area.
 o fill
This field is used when the component's display area is larger than the component's requested size.
 o gridheight
Specifies the number of cells in a column for the component's display area.
 o gridwidth
Specifies the number of cells in a row for the component's display area.
 o gridx
Specifies the cell at the left of the component's display area, where the leftmost cell has gridx = 0.
 o gridy
Specifies the cell at the top of the component's display area, where the topmost cell has gridy = 0.
 o insets
This field specifies the external padding of the component, the minimum amount of space between the component and the edges of its display area.
 o ipadx
This field specifies the internal padding of the component, how much space to add to the minimum width of the component.
 o ipady
This field specifies the internal padding, that is, how much space to add to the minimum height of the component.
 o weightx
Specifies how to distribute extra horizontal space.
 o weighty
Specifies how to distribute extra vertical space.

Constructor Index

 o java.awt.GridBagConstraints()
Creates a GridBagConstraint object with all of its fields set to their default value.

Method Index

 o clone()
Creates a copy of this grid bag constraint.

Variables

 o BOTH
public static final int BOTH
Resize the component both horizontally and vertically.

Since: JDK1.0
 o CENTER
public static final int CENTER
Put the component in the center of its display area.

Since: JDK1.0
 o EAST
public static final int EAST
Put the component on the right side of its display area, centered vertically.

Since: JDK1.0
 o HORIZONTAL
public static final int HORIZONTAL
Resize the component horizontally but not vertically.

Since: JDK1.0
 o NONE
public static final int NONE
Do not resize the component.

Since: JDK1.0
 o NORTH
public static final int NORTH
Put the component at the top of its display area, centered horizontally.

Since: JDK1.0
 o NORTHEAST
public static final int NORTHEAST
Put the component at the top-right corner of its display area.

Since: JDK1.0
 o NORTHWEST
public static final int NORTHWEST
Put the component at the top-left corner of its display area.

Since: JDK1.0
 o RELATIVE
public static final int RELATIVE
Specify that this component is the next-to-last component in its column or row (gridwidth, gridheight), or that this component be placed next to the previously added component (gridx, gridy).

Since: JDK1.0
See Also:
gridwidth, gridheight, gridx, gridy
 o REMAINDER
public static final int REMAINDER
Specify that this component is the last component in its column or row.

Since: JDK1.0
 o SOUTH
public static final int SOUTH
Put the component at the bottom of its display area, centered horizontally.

Since: JDK1.0
 o SOUTHEAST
public static final int SOUTHEAST
Put the component at the bottom-right corner of its display area.

Since: JDK1.0
 o SOUTHWEST
public static final int SOUTHWEST
Put the component at the bottom-left corner of its display area.

Since: JDK1.0
 o VERTICAL
public static final int VERTICAL
Resize the component vertically but not horizontally.

Since: JDK1.0
 o WEST
public static final int WEST
Put the component on the left side of its display area, centered vertically.

Since: JDK1.0
 o anchor
public int anchor
This field is used when the component is smaller than its display area. It determines where, within the display area, to place the component. Possible values are CENTER, NORTH, NORTHEAST, EAST, SOUTHEAST, SOUTH, SOUTHWEST, WEST, and NORTHWEST. The default value is CENTER.

Since: JDK1.0
 o fill
public int fill
This field is used when the component's display area is larger than the component's requested size. It determines whether to resize the component, and if so, how.

The following values are valid for fill:

  • NONE: Do not resize the component.
  • HORIZONTAL: Make the component wide enough to fill its display area horizontally, but do not change its height.
  • VERTICAL: Make the component tall enough to fill its display area vertically, but do not change its width.
  • BOTH: Make the component fill its display area entirely.

The default value is NONE.

Since: JDK1.0
 o gridheight
public int gridheight
Specifies the number of cells in a column for the component's display area.

Use REMAINDER to specify that the component be the last one in its column. Use RELATIVE to specify that the component be the next-to-last one in its column.

The default value is 1.

Since: JDK1.0
See Also:
gridwidth
 o gridwidth
public int gridwidth
Specifies the number of cells in a row for the component's display area.

Use REMAINDER to specify that the component be the last one in its row. Use RELATIVE to specify that the component be the next-to-last one in its row.

The default value is 1.

Since: JDK1.0
See Also:
gridheight
 o gridx
public int gridx
Specifies the cell at the left of the component's display area, where the leftmost cell has gridx = 0. The value RELATIVE specifies that the component be placed just to the right of the component that was added to the container just before this component was added.

The default value is RELATIVE.

Since: JDK1.0
See Also:
gridy
 o gridy
public int gridy
Specifies the cell at the top of the component's display area, where the topmost cell has gridy = 0. The value RELATIVE specifies that the component be placed just below the component that was added to the container just before this component was added.

The default value is RELATIVE.

Since: JDK1.0
See Also:
gridx
 o insets
public java.awt.Insets insets
This field specifies the external padding of the component, the minimum amount of space between the component and the edges of its display area.

The default value is new Insets(0, 0, 0, 0).

Since: JDK1.0
 o ipadx
public int ipadx
This field specifies the internal padding of the component, how much space to add to the minimum width of the component. The width of the component is at least its minimum width plus (ipadx * 2) pixels.

The default value is 0.

Since: JDK1.0
See Also:
ipady
 o ipady
public int ipady
This field specifies the internal padding, that is, how much space to add to the minimum height of the component. The height of the component is at least its minimum height plus (ipady * 2) pixels.

The default value is 0.

Since: JDK1.0
See Also:
ipadx
 o weightx
public double weightx
Specifies how to distribute extra horizontal space.

The grid bag layout manager calculates the weight of a column to be the maximum weighty of all the components in a row. If the resulting layout is smaller horizontally than the area it needs to fill, the extra space is distributed to each column in proportion to its weight. A column that has a weight zero receives no extra space.

If all the weights are zero, all the extra space appears between the grids of the cell and the left and right edges.

The default value of this field is 0.

Since: JDK1.0
See Also:
weighty
 o weighty
public double weighty
Specifies how to distribute extra vertical space.

The grid bag layout manager calculates the weight of a row to be the maximum weightx of all the components in a row. If the resulting layout is smaller vertically than the area it needs to fill, the extra space is distributed to each row in proportion to its weight. A row that has a weight of zero receives no extra space.

If all the weights are zero, all the extra space appears between the grids of the cell and the top and bottom edges.

The default value of this field is 0.

Since: JDK1.0
See Also:
weightx

Constructors

 o GridBagConstraints
public GridBagConstraints()
Creates a GridBagConstraint object with all of its fields set to their default value.

Since:
JDK1.0

Methods

 o clone
public java.lang.Object clone()
Creates a copy of this grid bag constraint.

Returns:
a copy of this grid bag constraint
Overrides:
clone in class Object
Since:
JDK1.0

All Packages  Class Hierarchy  This Package  Previous  Next  Index