@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 theSpringLayout
.java.lang.String
constraints
Returns specific constraints used by theBorderLayout
.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 hasgridx=0
.int
gridy
Specifies the cell at the top of the component's display area, where the topmost cell hasgridy=0
.int
height
Deprecated.since 1.1.0int[]
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 theSpringLayout
.java.lang.String
vConstraints
Returns specific constraints used by theSpringLayout
.double
weightx
Specifies how to distribute extra horizontal space.double
weighty
Specifies how to distribute extra vertical space.int
width
Deprecated.since 1.1.0int
x
Returns the absolute X coordinate.int
y
Returns the absolute Y coordinate.
-
Element Details
-
constraints
java.lang.String constraintsReturns specific constraints used by theBorderLayout
.- Returns:
- specific constraints used by the
BorderLayout
.
- Default:
- ""
-
x
int xReturns the absolute X coordinate.- Returns:
- The absolute X coordinate
- Default:
- -1
-
y
int yReturns the absolute Y coordinate.- Returns:
- The absolute Y coordinate
- Default:
- -1
-
height
int heightDeprecated.since 1.1.0Returns the height of the annotated component.- Returns:
- The height of the annotated component
- See Also:
Bounds.size()
- Default:
- -1
-
width
int widthDeprecated.since 1.1.0Returns the width of the annotated component.- Returns:
- The width of the annotated component
- See Also:
Bounds.size()
- Default:
- -1
-
gridx
int gridxSpecifies the cell containing the leading edge of the component's display area, where the first cell in a row hasgridx=0
.- Returns:
- the leading edge of the component's display area
- See Also:
GridBagConstraints.gridx
- Default:
- -1
-
gridy
int gridySpecifies the cell at the top of the component's display area, where the topmost cell hasgridy=0
.- Returns:
- the cell at the top of the component's display area
- See Also:
GridBagConstraints.gridy
- Default:
- -1
-
gridWidth
int gridWidthSpecifies 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 gridHeightSpecifies 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 weightxSpecifies 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 weightySpecifies 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 anchorThis 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 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.- Returns:
- whether the component should be resized
- See Also:
GridBagConstraints.fill
- Default:
- -1
-
insets
int[] insetsThis 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 ipadxThis 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 plusipadx
pixels.- Returns:
- The internal padding of the component
- See Also:
GridBagConstraints.ipadx
- Default:
- -1
-
ipady
int ipadyThis 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 plusipady
pixels.- Returns:
- The internal padding
- See Also:
GridBagConstraints.ipady
- Default:
- -1
-
vConstraints
java.lang.String vConstraintsReturns specific constraints used by theSpringLayout
.- Returns:
- specific constraints used by the
SpringLayout
.
- Default:
- ""
-
cConstraints
java.lang.String cConstraintsReturns specific constraints used by theSpringLayout
.- Returns:
- specific constraints used by the
SpringLayout
.
- Default:
- ""
-
pad
int padReturns the used padding when adding components to theSpringLayout
.- Returns:
- the used padding when adding components to the
SpringLayout
- Default:
- -1
-