Package swingtree

Enum Class UI.ComponentOrientation

java.lang.Object
java.lang.Enum<UI.ComponentOrientation>
swingtree.UI.ComponentOrientation
All Implemented Interfaces:
Serializable, Comparable<UI.ComponentOrientation>, Constable, UIEnum<UI.ComponentOrientation>
Enclosing class:
UI

@Immutable public static enum UI.ComponentOrientation extends Enum<UI.ComponentOrientation> implements UIEnum<UI.ComponentOrientation>
Names the reading direction of a component: LEFT_TO_RIGHT as in English, RIGHT_TO_LEFT as in Arabic or Hebrew, or UNKNOWN where none was chosen. It decides where a line of text begins, and therefore where the leading and the trailing end of a component are, which is why UI.HorizontalAlignment.LEADING and UI.HorizontalAlignment.TRAILING can only be resolved against one.
See UIForAnySwing.withStyle(Styler) and ComponentStyleDelegate.orientation(swingtree.UI.ComponentOrientation).
See Also:
  • Enum Constant Details

    • UNKNOWN

      public static final UI.ComponentOrientation UNKNOWN
      No reading direction was chosen, which SwingTree and AWT both read as left to right.
    • LEFT_TO_RIGHT

      public static final UI.ComponentOrientation LEFT_TO_RIGHT
      Lines of text run from left to right, as in English.
    • RIGHT_TO_LEFT

      public static final UI.ComponentOrientation RIGHT_TO_LEFT
      Lines of text run from right to left, as in Arabic or Hebrew.
  • Method Details

    • values

      public static UI.ComponentOrientation[] 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

      public static UI.ComponentOrientation valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • isLeftToRightOrUnknown

      public boolean isLeftToRightOrUnknown()
      Tells whether text and components laid out under this orientation run from left to right. UNKNOWN answers true here, which is the same choice AWT makes: ComponentOrientation.isLeftToRight() also answers true for ComponentOrientation.UNKNOWN. That is why a component whose orientation was never set behaves like an English one.
      Returns:
      True for LEFT_TO_RIGHT and UNKNOWN, false for RIGHT_TO_LEFT.