Package swingtree

Enum Class UI.VerticalAlignment

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

@Immutable public static enum UI.VerticalAlignment extends Enum<UI.VerticalAlignment> implements UIEnum<UI.VerticalAlignment>
Names where something sits on the vertical axis of a component: at the TOP, in the CENTER, or at the BOTTOM. UNDEFINED names no position, and passing it leaves the vertical alignment of the component untouched.

This is one half of a UI.Placement, which is a whole point of a component: UI.Placement.vertical() reads this half back out of such a point, and UI.Placement.of(VerticalAlignment, HorizontalAlignment) builds a point from this half and a UI.HorizontalAlignment.

See Also:
  • Enum Constant Details

    • UNDEFINED

      public static final UI.VerticalAlignment UNDEFINED
      No position, which leaves the vertical alignment of the component as it was.
    • TOP

      public static final UI.VerticalAlignment TOP
      At the top of the component.
    • CENTER

      public static final UI.VerticalAlignment CENTER
      Halfway between the top and the bottom of the component.
    • BOTTOM

      public static final UI.VerticalAlignment BOTTOM
      At the bottom of the component.
  • Method Details

    • values

      public static UI.VerticalAlignment[] 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.VerticalAlignment 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
    • forSwing

      public Optional<Integer> forSwing()
      Returns the number Swing uses for this position, which is what methods like JLabel.setVerticalAlignment(int) take.
      Returns:
      SwingConstants.TOP, SwingConstants.CENTER or SwingConstants.BOTTOM, and an empty Optional for UNDEFINED, which names no position to hand to Swing.