Annotation Type Position


@Retention(RUNTIME)
@Target({FIELD,TYPE})
public @interface Position
Use this annotation to place the components anywhere you like. The annotation class defines a lot of different attributes where each has a specific use-case. Usually, only a few of these attributes are used within the generation process.

The defined attributes may be used within the declared Layout to use.

Since:
1.0
  • Optional Element Summary

    Optional Elements 
    Modifier and Type Optional Element Description
    int anchor
    This attribute is used when the component is smaller than its display area.
    java.lang.String cConstraints
    Returns specific constraints used by the SpringLayout.
    java.lang.String constraints
    Returns specific constraints used by the BorderLayout.
    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 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.
    int height
    Deprecated.
    since 1.1.0
    int[] insets
    This attribute 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 attribute specifies the internal padding of the component, how much space to add to the minimum width of the component.
    int ipady
    This attribute specifies the internal padding, how much space to add to the minimum height of the component.
    int pad
    Returns the used padding when adding components to the SpringLayout.
    java.lang.String vConstraints
    Returns specific constraints used by the SpringLayout.
    double weightx
    Specifies how to distribute extra horizontal space.
    double weighty
    Specifies how to distribute extra vertical space.
    int width
    Deprecated.
    since 1.1.0
    int x
    Returns the absolute X coordinate.
    int y
    Returns the absolute Y coordinate.
  • Element Details

    • constraints

      java.lang.String constraints
      Returns specific constraints used by the BorderLayout.
      Returns:
      specific constraints used by the BorderLayout.
      Default:
      ""
    • x

      int x
      Returns the absolute X coordinate.
      Returns:
      The absolute X coordinate
      Default:
      -1
    • y

      int y
      Returns the absolute Y coordinate.
      Returns:
      The absolute Y coordinate
      Default:
      -1
    • height

      int height
      Deprecated.
      since 1.1.0
      Returns the height of the annotated component.
      Returns:
      The height of the annotated component
      See Also:
      Bounds.size()
      Default:
      -1
    • width

      int width
      Deprecated.
      since 1.1.0
      Returns the width of the annotated component.
      Returns:
      The width of the annotated component
      See Also:
      Bounds.size()
      Default:
      -1
    • gridx

      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.
      Returns:
      the leading edge of the component's display area
      See Also:
      GridBagConstraints.gridx
      Default:
      -1
    • gridy

      int gridy
      Specifies the cell at the top of the component's display area, where the topmost cell has gridy=0.
      Returns:
      the cell at the top of the component's display area
      See Also:
      GridBagConstraints.gridy
      Default:
      -1
    • gridWidth

      int gridWidth
      Specifies the number of cells in a row for the component's display area.
      Returns:
      the number of cells in a row for the component's display area.
      See Also:
      GridBagConstraints.gridwidth
      Default:
      -1
    • gridHeight

      int gridHeight
      Specifies the number of cells in a column for the component's display area.
      Returns:
      the number of cells in a column for the component's display area.
      See Also:
      GridBagConstraints.gridheight
      Default:
      -1
    • weightx

      double weightx
      Specifies how to distribute extra horizontal space.

      If all the weights are zero, all the extra space appears between the grids of the cell and the left and right edges.

      Returns:
      the value on how to distribute extra horizontal space
      See Also:
      GridBagConstraints.weightx
      Default:
      -1.0
    • weighty

      double weighty
      Specifies how to distribute extra vertical space.

      If all the weights are zero, all the extra space appears between the grids of the cell and the top and bottom edges.

      Returns:
      the value on how to distribute extra vertical space
      See Also:
      GridBagConstraints.weighty
      Default:
      -1.0
    • anchor

      int anchor
      This attribute is used when the component is smaller than its display area. It determines where, within the display area, to place the component.
      Returns:
      The point where the component should be placed within the display area.
      See Also:
      GridBagConstraints.anchor
      Default:
      -1
    • fill

      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.
      Returns:
      whether the component should be resized
      See Also:
      GridBagConstraints.fill
      Default:
      -1
    • insets

      int[] insets
      This attribute specifies the external padding of the component, the minimum amount of space between the component and the edges of its display area.

      The values provided here must be an array of four Integer numbers. They are wrapped in the following form:

           int[] padding = {top, left, bottom, right};
           Insets insets = new Insets(padding[0], ...);
       
      Returns:
      The external padding for the component
      See Also:
      Insets, GridBagConstraints.insets
      Default:
      {0, 0, 0, 0}
    • ipadx

      int ipadx
      This attribute 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 pixels.
      Returns:
      The internal padding of the component
      See Also:
      GridBagConstraints.ipadx
      Default:
      -1
    • ipady

      int ipady
      This attribute specifies the internal padding, 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 pixels.
      Returns:
      The internal padding
      See Also:
      GridBagConstraints.ipady
      Default:
      -1
    • vConstraints

      java.lang.String vConstraints
      Returns specific constraints used by the SpringLayout.
      Returns:
      specific constraints used by the SpringLayout.
      Default:
      ""
    • cConstraints

      java.lang.String cConstraints
      Returns specific constraints used by the SpringLayout.
      Returns:
      specific constraints used by the SpringLayout.
      Default:
      ""
    • pad

      int pad
      Returns the used padding when adding components to the SpringLayout.
      Returns:
      the used padding when adding components to the SpringLayout
      Default:
      -1