java.awt
Class GridBagConstraints

java.lang.Object
  |
  +--java.awt.GridBagConstraints
All Implemented Interfaces:
Cloneable, Serializable

public class GridBagConstraints
extends Object
implements Cloneable, Serializable

Safe:

See Also:
Serialized Form

Field Summary
 int anchor
          Suppressed: This field is used when the component is smaller than its display area.
static int BOTH
          Enabled: Resize the component both horizontally and vertically.
static int CENTER
          Enabled: Put the component in the center of its display area.
static int EAST
          Enabled: Put the component on the right side of its display area, centered vertically.
 int fill
          Enabled: This field is used when the component's display area is larger than the component's requested size.
static int FIRST_LINE_END
          Enabled: Place the component in the corner of its display area where the first line of text on a page would normally end for the current ComponentOrienation.
static int FIRST_LINE_START
          Enabled: Place the component in the corner of its display area where the first line of text on a page would normally begin for the current ComponentOrienation.
 int gridheight
          Enabled: Specifies the number of cells in a column for the component's display area.
 int gridwidth
          Enabled: Specifies the number of cells in a row for the component's display area.
 int gridx
          Enabled: Specifies the cell containing the leading edge of the component's display area, where the first cell in a row has gridx=0.
 int gridy
          Enabled: Specifies the cell at the top of the component's display area, where the topmost cell has gridy=0.
static int HORIZONTAL
          Enabled: Resize the component horizontally but not vertically.
 Insets insets
          Suppressed: This field specifies the external padding of the component, the minimum amount of space between the component and the edges of its display area.
 int ipadx
          Suppressed: This field specifies the internal padding of the component, how much space to add to the minimum width of the component.
 int ipady
          Suppressed: This field specifies the internal padding, that is, how much space to add to the minimum height of the component.
static int LAST_LINE_END
          Enabled: Place the component in the corner of its display area where the last line of text on a page would normally end for the current ComponentOrienation.
static int LAST_LINE_START
          Enabled: Place the component in the corner of its display area where the last line of text on a page would normally start for the current ComponentOrienation.
static int LINE_END
          Enabled: Place the component centered along the edge of its display area where lines of text would normally end for the current ComponentOrienation.
static int LINE_START
          Enabled: Place the component centered along the edge of its display area where lines of text would normally begin for the current ComponentOrienation.
(package private)  int minHeight
          The minimum height of the component.
(package private)  int minWidth
          The minimum width of the component.
static int NONE
          Enabled: Do not resize the component.
static int NORTH
          Enabled: Put the component at the top of its display area, centered horizontally.
static int NORTHEAST
          Enabled: Put the component at the top-right corner of its display area.
static int NORTHWEST
          Enabled: Put the component at the top-left corner of its display area.
static int PAGE_END
          Enabled: Place the component centered along the edge of its display area associated with the end of a page for the current ComponentOrienation.
static int PAGE_START
          Enabled: Place the component centered along the edge of its display area associated with the start of a page for the current ComponentOrienation.
static int RELATIVE
          Enabled: Specifies 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).
static int REMAINDER
          Enabled: Specifies that this component is the last component in its column or row.
private static long serialVersionUID
           
static int SOUTH
          Enabled: Put the component at the bottom of its display area, centered horizontally.
static int SOUTHEAST
          Enabled: Put the component at the bottom-right corner of its display area.
static int SOUTHWEST
          Enabled: Put the component at the bottom-left corner of its display area.
(package private)  int tempHeight
          Temporary place holder for the Height of the component.
(package private)  int tempWidth
          Temporary place holder for the Width of the component.
(package private)  int tempX
          Temporary place holder for the x coordinate.
(package private)  int tempY
          Temporary place holder for the y coordinate.
static int VERTICAL
          Enabled: Resize the component vertically but not horizontally.
 double weightx
          Enabled: Specifies how to distribute extra horizontal space.
 double weighty
          Enabled: Specifies how to distribute extra vertical space.
static int WEST
          Enabled: Put the component on the left side of its display area, centered vertically.
 
Constructor Summary
GridBagConstraints()
          Enabled: Creates a GridBagConstraint object with all of its fields set to their default value.
GridBagConstraints(int gridx, int gridy, int gridwidth, int gridheight, double weightx, double weighty, int anchor, int fill, Insets insets, int ipadx, int ipady)
          Enabled: Creates a GridBagConstraints object with all of its fields set to the passed-in arguments.
 
Method Summary
 Object clone()
          Suppressed: Creates a copy of this grid bag constraint.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RELATIVE

public static final int RELATIVE
Enabled: Specifies 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).

See Also:
java.awt.GridBagConstraints#gridwidth, java.awt.GridBagConstraints#gridheight, java.awt.GridBagConstraints#gridx, java.awt.GridBagConstraints#gridy

REMAINDER

public static final int REMAINDER
Enabled: Specifies that this component is the last component in its column or row.


NONE

public static final int NONE
Enabled: Do not resize the component.


BOTH

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


HORIZONTAL

public static final int HORIZONTAL
Enabled: Resize the component horizontally but not vertically.


VERTICAL

public static final int VERTICAL
Enabled: Resize the component vertically but not horizontally.


CENTER

public static final int CENTER
Enabled: Put the component in the center of its display area.


NORTH

public static final int NORTH
Enabled: Put the component at the top of its display area, centered horizontally.


NORTHEAST

public static final int NORTHEAST
Enabled: Put the component at the top-right corner of its display area.


EAST

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


SOUTHEAST

public static final int SOUTHEAST
Enabled: Put the component at the bottom-right corner of its display area.


SOUTH

public static final int SOUTH
Enabled: Put the component at the bottom of its display area, centered horizontally.


SOUTHWEST

public static final int SOUTHWEST
Enabled: Put the component at the bottom-left corner of its display area.


WEST

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


NORTHWEST

public static final int NORTHWEST
Enabled: Put the component at the top-left corner of its display area.


PAGE_START

public static final int PAGE_START
Enabled: Place the component centered along the edge of its display area associated with the start of a page for the current ComponentOrienation. Equal to NORTH for horizontal orientations.


PAGE_END

public static final int PAGE_END
Enabled: Place the component centered along the edge of its display area associated with the end of a page for the current ComponentOrienation. Equal to SOUTH for horizontal orientations.


LINE_START

public static final int LINE_START
Enabled: Place the component centered along the edge of its display area where lines of text would normally begin for the current ComponentOrienation. Equal to WEST for horizontal, left-to-right orientations and EAST for horizontal, right-to-left orientations.


LINE_END

public static final int LINE_END
Enabled: Place the component centered along the edge of its display area where lines of text would normally end for the current ComponentOrienation. Equal to EAST for horizontal, left-to-right orientations and WEST for horizontal, right-to-left orientations.


FIRST_LINE_START

public static final int FIRST_LINE_START
Enabled: Place the component in the corner of its display area where the first line of text on a page would normally begin for the current ComponentOrienation. Equal to NORTHWEST for horizontal, left-to-right orientations and NORTHEAST for horizontal, right-to-left orientations.


FIRST_LINE_END

public static final int FIRST_LINE_END
Enabled: Place the component in the corner of its display area where the first line of text on a page would normally end for the current ComponentOrienation. Equal to NORTHEAST for horizontal, left-to-right orientations and NORTHWEST for horizontal, right-to-left orientations.


LAST_LINE_START

public static final int LAST_LINE_START
Enabled: Place the component in the corner of its display area where the last line of text on a page would normally start for the current ComponentOrienation. Equal to SOUTHWEST for horizontal, left-to-right orientations and SOUTHEAST for horizontal, right-to-left orientations.


LAST_LINE_END

public static final int LAST_LINE_END
Enabled: Place the component in the corner of its display area where the last line of text on a page would normally end for the current ComponentOrienation. Equal to SOUTHEAST for horizontal, left-to-right orientations and SOUTHWEST for horizontal, right-to-left orientations.


gridx

public int gridx
Enabled: Specifies the cell containing the leading edge of the component's display area, where the first cell in a row has gridx=0. The leading edge of a component's display area is its left edge for a horizontal, left-to-right container and its right edge for a horizontal, right-to-left container. The value RELATIVE specifies that the component be placed immediately following the component that was added to the container just before this component was added.

The default value is RELATIVE. gridx should be a non-negative value.

See Also:
clone(), java.awt.GridBagConstraints#gridy, java.awt.ComponentOrientation

gridy

public int gridy
Enabled: 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. gridy should be a non-negative value.

See Also:
clone(), java.awt.GridBagConstraints#gridx

gridwidth

public int gridwidth
Enabled: 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.

gridwidth should be non-negative and the default value is 1.

See Also:
clone(), java.awt.GridBagConstraints#gridheight

gridheight

public int gridheight
Enabled: 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.

gridheight should be a non-negative value and the default value is 1.

See Also:
clone(), java.awt.GridBagConstraints#gridwidth

weightx

public double weightx
Enabled: Specifies how to distribute extra horizontal space.

The grid bag layout manager calculates the weight of a column to be the maximum weightx of all the components in a column. 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 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 left and right edges.

The default value of this field is 0. weightx should be a non-negative value.

See Also:
clone(), java.awt.GridBagConstraints#weighty

weighty

public double weighty
Enabled: Specifies how to distribute extra vertical space.

The grid bag layout manager calculates the weight of a row to be the maximum weighty 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. weighty should be a non-negative value.

See Also:
clone(), java.awt.GridBagConstraints#weightx

anchor

public int anchor
Suppressed: This field is used when the component is smaller than its display area. It determines where, within the display area, to place the component.

There are two kinds of possible values: relative and absolute. Relative values are interpreted relative to the container's component orientation property while absolute values are not. The absolute values are: CENTER, NORTH, NORTHEAST, EAST, SOUTHEAST, SOUTH, SOUTHWEST, WEST, and NORTHWEST. The relative values are: PAGE_START, PAGE_END, LINE_START, LINE_END, FIRST_LINE_START, FIRST_LINE_END, LAST_LINE_START and LAST_LINE_END. The default value is CENTER.

See Also:
clone(), java.awt.ComponentOrientation

fill

public int fill
Enabled: 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:

The default value is NONE.

See Also:
clone()

insets

public Insets insets
Suppressed: 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).

See Also:
clone()

ipadx

public int ipadx
Suppressed: 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.

See Also:
clone(), java.awt.GridBagConstraints#ipady

ipady

public int ipady
Suppressed: 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.

See Also:
clone(), java.awt.GridBagConstraints#ipadx

tempX

int tempX
Temporary place holder for the x coordinate.


tempY

int tempY
Temporary place holder for the y coordinate.


tempWidth

int tempWidth
Temporary place holder for the Width of the component.


tempHeight

int tempHeight
Temporary place holder for the Height of the component.


minWidth

int minWidth
The minimum width of the component. It is used to calculate ipady, where the default will be 0.

See Also:
ipady

minHeight

int minHeight
The minimum height of the component. It is used to calculate ipadx, where the default will be 0.

See Also:
ipadx

serialVersionUID

private static final long serialVersionUID
Constructor Detail

GridBagConstraints

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


GridBagConstraints

public GridBagConstraints(int gridx,
                          int gridy,
                          int gridwidth,
                          int gridheight,
                          double weightx,
                          double weighty,
                          int anchor,
                          int fill,
                          Insets insets,
                          int ipadx,
                          int ipady)
Enabled: Creates a GridBagConstraints object with all of its fields set to the passed-in arguments. Note: Because the use of this constructor hinders readability of source code, this constructor should only be used by automatic source code generation tools.

Parameters:
gridx - The initial gridx value.
gridy - The initial gridy value.
gridwidth - The initial gridwidth value.
gridheight - The initial gridheight value.
weightx - The initial weightx value.
weighty - The initial weighty value.
anchor - The initial anchor value.
fill - The initial fill value.
insets - The initial insets value.
ipadx - The initial ipadx value.
ipady - The initial ipady value.
Since:
1.2
See Also:
java.awt.GridBagConstraints#gridx, java.awt.GridBagConstraints#gridy, java.awt.GridBagConstraints#gridwidth, java.awt.GridBagConstraints#gridheight, java.awt.GridBagConstraints#weightx, java.awt.GridBagConstraints#weighty, java.awt.GridBagConstraints#anchor, java.awt.GridBagConstraints#fill, java.awt.GridBagConstraints#insets, java.awt.GridBagConstraints#ipadx, java.awt.GridBagConstraints#ipady
Method Detail

clone

public Object clone()
Suppressed: Creates a copy of this grid bag constraint.

Overrides:
clone in class Object
Returns:
a copy of this grid bag constraint
See Also:
java.lang.Cloneable


comments?