Package com.ardor3d.extension.ui.util
Enum Class Alignment
- All Implemented Interfaces:
Serializable
,Comparable<Alignment>
,Constable
Enumeration useful for describing positioning and alignment to the edges and corners of a rectangular area. This is
used in our UI system to align text, images, and handle certain layouts such as the AnchorLayout.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionSouthSouth WestSouth EastWestCenterEastNorthNorth WestNorth East -
Method Summary
Modifier and TypeMethodDescriptiondouble
alignX
(double availableWidth, double width) Determine the correct relative X position for a component being aligned, using this alignment, to another component (or a box to another box, or area... etc. - anything with a "width").int
alignX
(int availableWidth, int width) double
alignY
(double availableHeight, double height) Determine the correct relative Y position for a component being aligned, using this alignment, to another component (or a box to another box, or area... etc. - anything with a "height").int
alignY
(int availableHeight, int height) double
double
fromLeft()
static Alignment
Returns the enum constant of this class with the specified name.static Alignment[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
TOP_LEFT
North West -
TOP
North -
TOP_RIGHT
North East -
LEFT
West -
MIDDLE
Center -
RIGHT
East -
BOTTOM_LEFT
South West -
BOTTOM
South -
BOTTOM_RIGHT
South East
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
fromLeft
public double fromLeft()- Returns:
- a value in [0, 1] describing how far from the bottom this alignment is.
-
fromBottom
public double fromBottom()- Returns:
- a value in [0, 1] describing how far from the bottom this alignment is.
-
alignX
public double alignX(double availableWidth, double width) Determine the correct relative X position for a component being aligned, using this alignment, to another component (or a box to another box, or area... etc. - anything with a "width").- Parameters:
availableWidth
- the width of the component or area we are aligning to.width
- the width of the component or area we are setting position on.- Returns:
- the new X position to use.
-
alignX
public int alignX(int availableWidth, int width) -
alignY
public double alignY(double availableHeight, double height) Determine the correct relative Y position for a component being aligned, using this alignment, to another component (or a box to another box, or area... etc. - anything with a "height").- Parameters:
availableHeight
- the height of the component or area we are aligning to.height
- the height of the component or area we are setting position on.- Returns:
- the new Y position to use.
-
alignY
public int alignY(int availableHeight, int height)
-