JavaTM 2 Platform
Std. Ed. v1.3.1

java.awt
Class GridBagConstraints

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

public class GridBagConstraints
extends Object
implements Cloneable, Serializable

The GridBagConstraints class specifies constraints for components that are laid out using the GridBagLayout class.

Since:
JDK1.0
See Also:
GridBagLayout, Serialized Form

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.
 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 at the left of the component's display area, where the leftmost cell 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 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 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).
static int REMAINDER
          Specify 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

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).
See Also:
gridwidth, gridheight, gridx, gridy

REMAINDER

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

NONE

public static final int NONE
Do not resize the component.

BOTH

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

HORIZONTAL

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

VERTICAL

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

CENTER

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

NORTH

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

NORTHEAST

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

EAST

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

SOUTHEAST

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

SOUTH

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

SOUTHWEST

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

WEST

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

NORTHWEST

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

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. gridx should be a non-negative value.

See Also:
clone(), gridy

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

See Also:
clone(), gridx

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.

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

See Also:
clone(), gridheight

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.

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

See Also:
clone(), gridwidth

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 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(), weighty

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 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(), weightx

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.
See Also:
clone()

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:

The default value is NONE.

See Also:
clone()

insets

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 new Insets(0, 0, 0, 0).

See Also:
clone()

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.

See Also:
clone(), ipady

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.

See Also:
clone(), ipadx
Constructor Detail

GridBagConstraints

public GridBagConstraints()
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)
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:
gridx, gridy, gridwidth, gridheight, weightx, weighty, anchor, fill, insets, ipadx, ipady
Method Detail

clone

public Object clone()
Creates a copy of this grid bag constraint.
Overrides:
clone in class Object
Returns:
a copy of this grid bag constraint

JavaTM 2 Platform
Std. Ed. v1.3.1

Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2001 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.



Spec-Zone.ru - all specs in one place



free hit counter