GridBagConstraints class specifies constraints
for components that are laid out using the
GridBagLayout class.
java.awt.GridBagLayout
| Modifier and Type | Field and Description |
|---|---|
| public static final int | ABOVE_BASELINE
Possible value for the |
| public static final int | ABOVE_BASELINE_LEADING
Possible value for the |
| public static final int | ABOVE_BASELINE_TRAILING
Possible value for the |
| public int | anchor
This field is used when the component is smaller than its display area. |
| pack-priv transient int | |
| public static final int | BASELINE
Possible value for the |
| public static final int | BASELINE_LEADING
Possible value for the |
| public static final int | BASELINE_TRAILING
Possible value for the |
| pack-priv transient Component. | |
| public static final int | BELOW_BASELINE
Possible value for the |
| public static final int | BELOW_BASELINE_LEADING
Possible value for the |
| public static final int | BELOW_BASELINE_TRAILING
Possible value for the |
| public static final int | BOTH
Resize the component both horizontally and vertically. |
| public static final int | CENTER
Put the component in the center of its display area. |
| pack-priv transient int | |
| pack-priv transient int | |
| pack-priv transient int | |
| public static final int | EAST
Put the component on the right side of its display area, centered vertically. |
| public int | fill
This field is used when the component's display area is larger than the component's requested size. |
| public static final int | FIRST_LINE_END
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
|
| public static final int | FIRST_LINE_START
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
|
| public int | gridheight
Specifies the number of cells in a column for the component's display area. |
| public int | gridwidth
Specifies the number of cells in a row for the component's display area. |
| public int | gridx
Specifies the cell containing the leading edge of the component's
display area, where the first cell in a row has |
| public int | gridy
Specifies the cell at the top of the component's display area,
where the topmost cell has |
| public static final int | HORIZONTAL
Resize the component horizontally but not vertically. |
| public 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. |
| public int | ipadx
This field specifies the internal padding of the component, how much space to add to the minimum width of the component. |
| public int | ipady
This field specifies the internal padding, that is, how much space to add to the minimum height of the component. |
| public static final int | LAST_LINE_END
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
|
| public static final int | LAST_LINE_START
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
|
| public static final int | LINE_END
Place the component centered along the edge of its display area where
lines of text would normally end for the current
|
| public static final int | LINE_START
Place the component centered along the edge of its display area where
lines of text would normally begin for the current
|
| pack-priv int | minHeight
The minimum height of the component. |
| pack-priv int | minWidth
The minimum width of the component. |
| public static final int | NONE
Do not resize the component. |
| public static final int | NORTH
Put the component at the top of its display area, centered horizontally. |
| public static final int | NORTHEAST
Put the component at the top-right corner of its display area. |
| public static final int | NORTHWEST
Put the component at the top-left corner of its display area. |
| public static final int | PAGE_END
Place the component centered along the edge of its display area
associated with the end of a page for the current
|
| public static final int | PAGE_START
Place the component centered along the edge of its display area
associated with the start of a page for the current
|
| public static final int | RELATIVE
Specifies that this component is the next-to-last component in its
column or row ( |
| public static final int | REMAINDER
Specifies that this component is the last component in its column or row. |
| private static final long | serialVersionUID
Use serialVersionUID from JDK 1.1 for interoperability. |
| public static final int | SOUTH
Put the component at the bottom of its display area, centered horizontally. |
| public static final int | SOUTHEAST
Put the component at the bottom-right corner of its display area. |
| public static final int | SOUTHWEST
Put the component at the bottom-left corner of its display area. |
| pack-priv int | tempHeight
Temporary place holder for the Height of the component. |
| pack-priv int | tempWidth
Temporary place holder for the Width of the component. |
| pack-priv int | tempX
Temporary place holder for the x coordinate. |
| pack-priv int | tempY
Temporary place holder for the y coordinate. |
| public static final int | VERTICAL
Resize the component vertically but not horizontally. |
| public double | weightx
Specifies how to distribute extra horizontal space. |
| public double | weighty
Specifies how to distribute extra vertical space. |
| public static final int | WEST
Put the component on the left side of its display area, centered vertically. |
| Access | Constructor and Description |
|---|---|
| public | GridBagConstraints()
Creates a |
| public | GridBagConstraints(int
The initial gridx value. gridx, int The initial gridy value. gridy, int The initial gridwidth value. gridwidth, int The initial gridheight value. gridheight, double The initial weightx value. weightx, double The initial weighty value. weighty, int The initial anchor value. anchor, int The initial fill value. fill, Insets The initial insets value. insets, int The initial ipadx value. ipadx, int The initial ipady value. ipady)Creates a |
| Modifier and Type | Method and Description |
|---|---|
| public Object | Returns: a copy of this grid bag constraintOverrides java. Creates a copy of this grid bag constraint. |
| pack-priv boolean |
| ABOVE_BASELINE | back to summary |
|---|---|
| public static final int ABOVE_BASELINE Possible value for the
| |
| ABOVE_BASELINE_LEADING | back to summary |
|---|---|
| public static final int ABOVE_BASELINE_LEADING Possible value for the
| |
| ABOVE_BASELINE_TRAILING | back to summary |
|---|---|
| public static final int ABOVE_BASELINE_TRAILING Possible value for the
| |
| anchor | back to summary |
|---|---|
| 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. There are three kinds of possible values: orientation
relative, baseline relative and absolute. Orientation relative
values are interpreted relative to the container's component
orientation property, baseline relative values are interpreted
relative to the baseline and absolute values are not. The
absolute values are:
| |
| ascent | back to summary |
|---|---|
| pack-priv transient int ascent | |
| BASELINE | back to summary |
|---|---|
| public static final int BASELINE Possible value for the
| |
| BASELINE_LEADING | back to summary |
|---|---|
| public static final int BASELINE_LEADING Possible value for the
| |
| BASELINE_TRAILING | back to summary |
|---|---|
| public static final int BASELINE_TRAILING Possible value for the
| |
| baselineResizeBehavior | back to summary |
|---|---|
| pack-priv transient Component. | |
| BELOW_BASELINE | back to summary |
|---|---|
| public static final int BELOW_BASELINE Possible value for the
| |
| BELOW_BASELINE_LEADING | back to summary |
|---|---|
| public static final int BELOW_BASELINE_LEADING Possible value for the
| |
| BELOW_BASELINE_TRAILING | back to summary |
|---|---|
| public static final int BELOW_BASELINE_TRAILING Possible value for the
| |
| BOTH | back to summary |
|---|---|
| public static final int BOTH Resize the component both horizontally and vertically. | |
| CENTER | back to summary |
|---|---|
| public static final int CENTER Put the component in the center of its display area. | |
| centerOffset | back to summary |
|---|---|
| pack-priv transient int centerOffset | |
| centerPadding | back to summary |
|---|---|
| pack-priv transient int centerPadding | |
| descent | back to summary |
|---|---|
| pack-priv transient int descent | |
| EAST | back to summary |
|---|---|
| public static final int EAST Put the component on the right side of its display area, centered vertically. | |
| fill | back to summary |
|---|---|
| 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
The default value is
| |
| FIRST_LINE_END | back to summary |
|---|---|
| public static final int FIRST_LINE_END 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
| |
| FIRST_LINE_START | back to summary |
|---|---|
| public static final int FIRST_LINE_START 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
| |
| gridheight | back to summary |
|---|---|
| public int gridheight Specifies the number of cells in a column for the component's display area.
Use
| |
| gridwidth | back to summary |
|---|---|
| public int gridwidth Specifies the number of cells in a row for the component's display area.
Use
| |
| gridx | back to summary |
|---|---|
| public int gridx Specifies the cell containing the leading edge of the component's
display area, where the first cell in a row has
The default value is | |
| gridy | back to summary |
|---|---|
| public int gridy Specifies the cell at the top of the component's display area,
where the topmost cell has
The default value is
| |
| HORIZONTAL | back to summary |
|---|---|
| public static final int HORIZONTAL Resize the component horizontally but not vertically. | |
| insets | back to summary |
|---|---|
| public 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
| |
| ipadx | back to summary |
|---|---|
| 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
The default value is
| |
| ipady | back to summary |
|---|---|
| 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
The default value is 0.
| |
| LAST_LINE_END | back to summary |
|---|---|
| public static final int LAST_LINE_END 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
| |
| LAST_LINE_START | back to summary |
|---|---|
| public static final int LAST_LINE_START 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
| |
| LINE_END | back to summary |
|---|---|
| public static final int LINE_END Place the component centered along the edge of its display area where
lines of text would normally end for the current
| |
| LINE_START | back to summary |
|---|---|
| public static final int LINE_START Place the component centered along the edge of its display area where
lines of text would normally begin for the current
| |
| minHeight | back to summary |
|---|---|
| pack-priv int minHeight The minimum height of the component. It is used to calculate
| |
| minWidth | back to summary |
|---|---|
| pack-priv int minWidth The minimum width of the component. It is used to calculate
| |
| NONE | back to summary |
|---|---|
| public static final int NONE Do not resize the component. | |
| NORTH | back to summary |
|---|---|
| public static final int NORTH Put the component at the top of its display area, centered horizontally. | |
| NORTHEAST | back to summary |
|---|---|
| public static final int NORTHEAST Put the component at the top-right corner of its display area. | |
| NORTHWEST | back to summary |
|---|---|
| public static final int NORTHWEST Put the component at the top-left corner of its display area. | |
| PAGE_END | back to summary |
|---|---|
| public static final int PAGE_END Place the component centered along the edge of its display area
associated with the end of a page for the current
| |
| PAGE_START | back to summary |
|---|---|
| public static final int PAGE_START Place the component centered along the edge of its display area
associated with the start of a page for the current
| |
| RELATIVE | back to summary |
|---|---|
| public static final int RELATIVE Specifies that this component is the next-to-last component in its
column or row ( | |
| REMAINDER | back to summary |
|---|---|
| public static final int REMAINDER Specifies that this component is the last component in its column or row. | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Use serialVersionUID from JDK 1.1 for interoperability. | |
| SOUTH | back to summary |
|---|---|
| public static final int SOUTH Put the component at the bottom of its display area, centered horizontally. | |
| SOUTHEAST | back to summary |
|---|---|
| public static final int SOUTHEAST Put the component at the bottom-right corner of its display area. | |
| SOUTHWEST | back to summary |
|---|---|
| public static final int SOUTHWEST Put the component at the bottom-left corner of its display area. | |
| tempHeight | back to summary |
|---|---|
| pack-priv int tempHeight Temporary place holder for the Height of the component. | |
| tempWidth | back to summary |
|---|---|
| pack-priv int tempWidth Temporary place holder for the Width of the component. | |
| tempX | back to summary |
|---|---|
| pack-priv int tempX Temporary place holder for the x coordinate. | |
| tempY | back to summary |
|---|---|
| pack-priv int tempY Temporary place holder for the y coordinate. | |
| VERTICAL | back to summary |
|---|---|
| public static final int VERTICAL Resize the component vertically but not horizontally. | |
| weightx | back to summary |
|---|---|
| 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 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
| |
| weighty | back to summary |
|---|---|
| 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 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
| |
| WEST | back to summary |
|---|---|
| public static final int WEST Put the component on the left side of its display area, centered vertically. | |
| GridBagConstraints | back to summary |
|---|---|
| public GridBagConstraints() Creates a | |
| GridBagConstraints | back to summary |
|---|---|
| public GridBagConstraints(int gridx, int gridy, int gridwidth, int gridheight, double weightx, double weighty, int anchor, int fill, Insets insets, int ipadx, int ipady) Creates a Note Because the use of this constructor hinders readability of source code, this constructor should only be used by automatic source code generation tools.
| |
| clone | back to summary |
|---|---|
| public Object clone() Overrides java. Creates a copy of this grid bag constraint.
| |
| isVerticallyResizable | back to summary |
|---|---|
| pack-priv boolean isVerticallyResizable() | |