Class GridBagConstraints
- All Implemented Interfaces:
Serializable,Cloneable
GridBagConstraints specifies constraints for components that are laid
out using GridBagLayout.
Note, GridBagLayout implicitly clones the GridBagConstraints
instance when applying it to specific components.- Author:
- Vaadin Ltd
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionintThis field is used when the component is smaller than its display area.static final intResize the component both horizontally and vertically.static final intCenter the component within its display area, both horizontally and vertically.intThis field is used when the component's display area is larger than the component's requested size.static final intPosition the component in the corner of its display area where the first line of text would normally end.static final intPosition the component in the corner of its display area where the first line of text would normally start.intSpecifies the number of cells in a column for the component's display area.intSpecifies the number of cells in a row for the component's display area.intSpecifies the cell containing the leading edge of the component's display area, where the first cell in a row hasgridx=0.intSpecifies the cell at the top of the component's display area, where the topmost cell hasgridy=0.static final intResize the component horizontally but not vertically.Specifies the external padding of the component, determining the minimum amount of space between the component and the edges of its display area.intSpecifies the internal padding of the component, determining how much space to add to the component's preferred width.intSpecifies the internal padding of the component, determining how much space to add to the component's preferred height.static final intPosition the component in the corner of its display area where the last line of text would normally end.static final intPosition the component in the corner of its display area where the last line of text would normally start.static final intCenter the component on the right (or end) edge of its display area, vertically.static final intCenter the component on the left (or start) edge of its display area, vertically.static final intDo not resize the component.static final intCenter the component at the bottom of its display area, horizontally.static final intCenter the component at the top of its display area, horizontally.static final intSpecifies that the component should be placed next in the row (forgridx) or column (forgridy) relative to the previously added component.static final intSpecifies that the component is the last component in its column or row.static final intResize the component vertically but not horizontally. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new grid bag constraint with all of its fields set to their default value. -
Method Summary
-
Field Details
-
RELATIVE
public static final int RELATIVESpecifies that the component should be placed next in the row (forgridx) or column (forgridy) relative to the previously added component. When used for bothgridxandgridy, the component will be placed next to the last component in the first available row.Possible value for the
gridxandgridyfields.- See Also:
-
REMAINDER
public static final int REMAINDERSpecifies that the component is the last component in its column or row.Possible value for the
gridwidthandgridheightfields.- See Also:
-
NONE
public static final int NONEDo not resize the component.Possible value for the
fillfield.- See Also:
-
BOTH
public static final int BOTHResize the component both horizontally and vertically.Possible value for the
fillfield.- See Also:
-
HORIZONTAL
public static final int HORIZONTALResize the component horizontally but not vertically.Possible value for the
fillfield.- See Also:
-
VERTICAL
public static final int VERTICALResize the component vertically but not horizontally.Possible value for the
fillfield.- See Also:
-
CENTER
public static final int CENTERCenter the component within its display area, both horizontally and vertically.Possible value for the
anchorfield.- See Also:
-
PAGE_START
public static final int PAGE_STARTCenter the component at the top of its display area, horizontally.Possible value for the
anchorfield.- See Also:
-
PAGE_END
public static final int PAGE_ENDCenter the component at the bottom of its display area, horizontally.Possible value for the
anchorfield.- See Also:
-
LINE_START
public static final int LINE_STARTCenter the component on the left (or start) edge of its display area, vertically.Possible value for the
anchorfield.- See Also:
-
LINE_END
public static final int LINE_ENDCenter the component on the right (or end) edge of its display area, vertically.Possible value for the
anchorfield.- See Also:
-
FIRST_LINE_START
public static final int FIRST_LINE_STARTPosition the component in the corner of its display area where the first line of text would normally start.Possible value for the
anchorfield.- See Also:
-
FIRST_LINE_END
public static final int FIRST_LINE_ENDPosition the component in the corner of its display area where the first line of text would normally end. Possible value for theanchorfield.- See Also:
-
LAST_LINE_START
public static final int LAST_LINE_STARTPosition the component in the corner of its display area where the last line of text would normally start.Possible value for the
anchorfield.- See Also:
-
LAST_LINE_END
public static final int LAST_LINE_ENDPosition the component in the corner of its display area where the last line of text would normally end.Possible value for the
anchorfield.- See Also:
-
gridx
public int gridxSpecifies the cell containing the leading edge of the component's display area, where the first cell in a row hasgridx=0.gridyshould be a non-negative value and the default value isRELATIVE -
gridy
public int gridySpecifies the cell at the top of the component's display area, where the topmost cell hasgridy=0.gridyshould be a non-negative value and the default value isRELATIVE -
gridwidth
public int gridwidthSpecifies the number of cells in a row for the component's display area.gridwidthshould be non-negative and the default value is 1. -
gridheight
public int gridheightSpecifies the number of cells in a column for the component's display area.gridheightshould be a non-negative value and the default value is 1. -
anchor
public int anchorThis 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,PAGE_START,PAGE_END,LINE_START,LINE_END,FIRST_LINE_START,FIRST_LINE_END,LAST_LINE_STARTandLAST_LINE_END.The default value is
CENTER. -
fill
public int fillThis 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.Possible values are
NONE,HORIZONTAL,VERTICALandBOTH.The default value is
NONE. -
insets
Specifies the external padding of the component, determining 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). -
ipadx
public int ipadxSpecifies the internal padding of the component, determining how much space to add to the component's preferred width.Note, the padding has effect only when the component has an explicitly set preferred size via
ComponentGeometryUtil.setPreferredSize(com.vaadin.flow.component.Component, com.vaadin.featurepack.desktop.geometry.Dimension).The default value is
0. -
ipady
public int ipadySpecifies the internal padding of the component, determining how much space to add to the component's preferred height.Note, the padding has effect only when the component has an explicitly set preferred size via
ComponentGeometryUtil.setPreferredSize(com.vaadin.flow.component.Component, com.vaadin.featurepack.desktop.geometry.Dimension).The default value is
0.
-
-
Constructor Details
-
GridBagConstraints
public GridBagConstraints()Creates a new grid bag constraint with all of its fields set to their default value.
-
-
Method Details