Class GridBagConstraints

java.lang.Object
com.vaadin.featurepack.desktop.layouts.GridBagConstraints
All Implemented Interfaces:
Serializable, Cloneable

public class GridBagConstraints extends Object implements Cloneable, Serializable
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

    Fields
    Modifier and Type
    Field
    Description
    int
    This field is used when the component is smaller than its display area.
    static final int
    Resize the component both horizontally and vertically.
    static final int
    Center the component within its display area, both horizontally and vertically.
    int
    This field is used when the component's display area is larger than the component's requested size.
    static final int
    Position the component in the corner of its display area where the first line of text would normally end.
    static final int
    Position the component in the corner of its display area where the first line of text would normally start.
    int
    Specifies the number of cells in a column for the component's display area.
    int
    Specifies the number of cells in a row for the component's display area.
    int
    Specifies the cell containing the leading edge of the component's display area, where the first cell in a row has gridx=0.
    int
    Specifies the cell at the top of the component's display area, where the topmost cell has gridy=0.
    static final int
    Resize 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.
    int
    Specifies the internal padding of the component, determining how much space to add to the component's preferred width.
    int
    Specifies the internal padding of the component, determining how much space to add to the component's preferred height.
    static final int
    Position the component in the corner of its display area where the last line of text would normally end.
    static final int
    Position the component in the corner of its display area where the last line of text would normally start.
    static final int
    Center the component on the right (or end) edge of its display area, vertically.
    static final int
    Center the component on the left (or start) edge of its display area, vertically.
    static final int
    Do not resize the component.
    static final int
    Center the component at the bottom of its display area, horizontally.
    static final int
    Center the component at the top of its display area, horizontally.
    static final int
    Specifies that the component should be placed next in the row (for gridx) or column (for gridy) relative to the previously added component.
    static final int
    Specifies that the component is the last component in its column or row.
    static final int
    Resize the component vertically but not horizontally.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new grid bag constraint with all of its fields set to their default value.
  • Method Summary

    Modifier and Type
    Method
    Description
    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 Details

    • RELATIVE

      public static final int RELATIVE
      Specifies that the component should be placed next in the row (for gridx) or column (for gridy) relative to the previously added component. When used for both gridx and gridy, the component will be placed next to the last component in the first available row.

      Possible value for the gridx and gridy fields.

      See Also:
    • REMAINDER

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

      Possible value for the gridwidth and gridheight fields.

      See Also:
    • NONE

      public static final int NONE
      Do not resize the component.

      Possible value for the fill field.

      See Also:
    • BOTH

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

      Possible value for the fill field.

      See Also:
    • HORIZONTAL

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

      Possible value for the fill field.

      See Also:
    • VERTICAL

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

      Possible value for the fill field.

      See Also:
    • CENTER

      public static final int CENTER
      Center the component within its display area, both horizontally and vertically.

      Possible value for the anchor field.

      See Also:
    • PAGE_START

      public static final int PAGE_START
      Center the component at the top of its display area, horizontally.

      Possible value for the anchor field.

      See Also:
    • PAGE_END

      public static final int PAGE_END
      Center the component at the bottom of its display area, horizontally.

      Possible value for the anchor field.

      See Also:
    • LINE_START

      public static final int LINE_START
      Center the component on the left (or start) edge of its display area, vertically.

      Possible value for the anchor field.

      See Also:
    • LINE_END

      public static final int LINE_END
      Center the component on the right (or end) edge of its display area, vertically.

      Possible value for the anchor field.

      See Also:
    • FIRST_LINE_START

      public static final int FIRST_LINE_START
      Position the component in the corner of its display area where the first line of text would normally start.

      Possible value for the anchor field.

      See Also:
    • FIRST_LINE_END

      public static final int FIRST_LINE_END
      Position the component in the corner of its display area where the first line of text would normally end. Possible value for the anchor field.
      See Also:
    • LAST_LINE_START

      public static final int LAST_LINE_START
      Position the component in the corner of its display area where the last line of text would normally start.

      Possible value for the anchor field.

      See Also:
    • LAST_LINE_END

      public static final int LAST_LINE_END
      Position the component in the corner of its display area where the last line of text would normally end.

      Possible value for the anchor field.

      See Also:
    • gridx

      public 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.

      gridy should be a non-negative value and the default value is RELATIVE

    • gridy

      public int gridy
      Specifies the cell at the top of the component's display area, where the topmost cell has gridy=0.

      gridy should be a non-negative value and the default value is RELATIVE

    • gridwidth

      public int gridwidth
      Specifies the number of cells in a row for the component's display area.

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

    • gridheight

      public int gridheight
      Specifies the number of cells in a column for the component's display area.

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

    • 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, 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.

    • 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.

      Possible values are NONE, HORIZONTAL, VERTICAL and BOTH.

      The default value is NONE.

    • insets

      public Insets 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 ipadx
      Specifies 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 ipady
      Specifies 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

    • clone

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