Enum Class UI.HorizontalAlignment
- All Implemented Interfaces:
Serializable,Comparable<UI.HorizontalAlignment>,Constable,UIEnum<UI.HorizontalAlignment>
- Enclosing class:
UI
LEFT, in the CENTER, at the RIGHT, or at the
LEADING or TRAILING end of a line of text. UNDEFINED
names no position, and passing it leaves the horizontal alignment of the component
untouched.
LEADING and TRAILING are the two constants which are not sides.
They mean "where a line of text begins" and "where it ends", which is the left and
the right in English, and the right and the left in Arabic or Hebrew. Swing answers
that question from the ComponentOrientation of the component the
alignment is applied to, so a component aligned this way follows the reading
direction it ends up in.
This is one half of a UI.Placement, which is a whole point of a component.
A point has already been placed, so UI.Placement.horizontal() never answers
with LEADING or TRAILING; building a point out of either of them
through UI.Placement.of(VerticalAlignment, HorizontalAlignment, ComponentOrientation) is where the reading direction is read exactly once.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionHalfway between the left and the right of the component.Where a line of text begins: the left in English, the right in Arabic or Hebrew.At the left of the component, whichever way it reads.At the right of the component, whichever way it reads.Where a line of text ends: the right in English, the left in Arabic or Hebrew.No position, which leaves the horizontal alignment of the component as it was. -
Method Summary
Modifier and TypeMethodDescriptionReturns the numberFlowLayoutuses for this position, which is what itsFlowLayout.setAlignment(int)method and its constructors take.forSwing()Returns the number Swing uses for this position, which is what methods likeJLabel.setHorizontalAlignment(int)take.static UI.HorizontalAlignmentReturns the enum constant of this class with the specified name.static UI.HorizontalAlignment[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
UNDEFINED
No position, which leaves the horizontal alignment of the component as it was. -
LEFT
At the left of the component, whichever way it reads. -
CENTER
Halfway between the left and the right of the component. -
RIGHT
At the right of the component, whichever way it reads. -
LEADING
Where a line of text begins: the left in English, the right in Arabic or Hebrew. -
TRAILING
Where a line of text ends: the right in English, the left in Arabic or Hebrew.
-
-
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
-
forSwing
Returns the number Swing uses for this position, which is what methods likeJLabel.setHorizontalAlignment(int)take. Swing resolvesSwingConstants.LEADINGandSwingConstants.TRAILINGitself, from the orientation of the component they are given to.- Returns:
SwingConstants.LEFT,SwingConstants.CENTER,SwingConstants.RIGHT,SwingConstants.LEADINGorSwingConstants.TRAILING, and an emptyOptionalforUNDEFINED, which names no position to hand to Swing.
-
forFlowLayout
Returns the numberFlowLayoutuses for this position, which is what itsFlowLayout.setAlignment(int)method and its constructors take.- Returns:
FlowLayout.LEFT,FlowLayout.CENTER,FlowLayout.RIGHT,FlowLayout.LEADINGorFlowLayout.TRAILING, and an emptyOptionalforUNDEFINED, which names no position to hand to the layout.
-