java.lang.Object java.awt.GridBagConstraints
The GridBagConstraints class specifies constraints for components that are laid out using the GridBagLayout class.
Field Summary | |
---|---|
int |
anchor
This field is used when the component is smaller than its display area. |
static int |
BOTH
Resize the component both horizontally and vertically. |
static int |
CENTER
Put the component in the center of its display area. |
static int |
EAST
Put the component on the right side of its display area, centered vertically. |
int |
fill
This field is used when the component's display area is larger than the component's requested size. |
static 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 ComponentOrienation. |
static 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 ComponentOrienation. |
int |
gridheight
Specifies the number of cells in a column for the component's display area. |
int |
gridwidth
Specifies the number of cells in a row for the component's display area. |
int |
gridx
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
Specifies the cell at the top of the component's display area, where the topmost cell has gridy=0. |
static int |
HORIZONTAL
Resize the component horizontally but not vertically. |
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. |
int |
ipadx
This field specifies the internal padding of the component, how much space to add to the minimum width of the component. |
int |
ipady
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
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
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
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
Place the component centered along the edge of its display area where lines of text would normally begin for the current ComponentOrienation. |
static int |
NONE
Do not resize the component. |
static int |
NORTH
Put the component at the top of its display area, centered horizontally. |
static int |
NORTHEAST
Put the component at the top-right corner of its display area. |
static int |
NORTHWEST
Put the component at the top-left corner of its display area. |
static int |
PAGE_END
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
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
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
Specifies that this component is the last component in its column or row. |
static int |
SOUTH
Put the component at the bottom of its display area, centered horizontally. |
static int |
SOUTHEAST
Put the component at the bottom-right corner of its display area. |
static int |
SOUTHWEST
Put the component at the bottom-left corner of its display area. |
static int |
VERTICAL
Resize the component vertically but not horizontally. |
double |
weightx
Specifies how to distribute extra horizontal space. |
double |
weighty
Specifies how to distribute extra vertical space. |
static int |
WEST
Put the component on the left side of its display area, centered vertically. |
Constructor Summary | |
---|---|
GridBagConstraints
() 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) Creates a GridBagConstraints object with all of its fields set to the passed-in arguments. |
Method Summary | |
---|---|
Object |
clone
() 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 |
---|
public static final int RELATIVE
public static final int REMAINDER
public static final int NONE
public static final int BOTH
public static final int HORIZONTAL
public static final int VERTICAL
public static final int CENTER
public static final int NORTH
public static final int NORTHEAST
public static final int EAST
public static final int SOUTHEAST
public static final int SOUTH
public static final int SOUTHWEST
public static final int WEST
public static final int NORTHWEST
public static final int PAGE_START
public static final int PAGE_END
public static final int LINE_START
public static final int LINE_END
public static final int FIRST_LINE_START
public static final int FIRST_LINE_END
public static final int LAST_LINE_START
public static final int LAST_LINE_END
public int gridx
The default value is RELATIVE. gridx should be a non-negative value.
public int gridy
The default value is RELATIVE. gridy should be a non-negative value.
public int gridwidth
Use REMAINDER to specify that the
component's display area will
component
be
from gridx to
the last
cell
one
in
the
its
row. Use RELATIVE to specify that the
component's display area will
component
be
from gridx to
the
next to the last
next-to-last
one in its row.
gridwidth should be non-negative and the default value is 1.
public int gridheight
Use REMAINDER to specify that the
component's display area will
component
be
from gridy to
the last
cell
one
in
the
its
column. Use RELATIVE to specify that the
component's display area will
component
be
from gridy to
the
next to the last
next-to-last
one in its column.
gridheight should be a non-negative value and the default value is 1.
public double weightx
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.
public double weighty
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.
public int anchor
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.
public int fill
The following values are valid for fill:
The default value is NONE.
public Insets insets
The default value is new Insets(0, 0, 0, 0).
public int ipadx
The default value is 0.
public int ipady
The default value is 0.
Constructor Detail |
---|
public 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)
Method Detail |
---|
public Object clone()