Package swingtree

Enum Class UI.Corner

All Implemented Interfaces:
Serializable, Comparable<UI.Corner>, Constable, UIEnum<UI.Corner>
Enclosing class:
UI

@Immutable public static enum UI.Corner extends Enum<UI.Corner> implements UIEnum<UI.Corner>
Names one corner of a component, or, as EVERY, all four of them at once. Pass one to ComponentStyleDelegate.borderRadiusAt(swingtree.UI.Corner, double, double) in the style API (see UIForAnySwing.withStyle(Styler)) to round that corner by itself, which is how a component takes a shape other than a plain rectangle.

opposite() names the corner diagonally across the component, so that a shape rounding two facing corners can be driven by a single value, and toPlacement() turns the corner into the point sitting at it, for the parts of the API which place things by UI.Placement.

See Also:
  • Enum Constant Details

    • EVERY

      public static final UI.Corner EVERY
      All four corners at once, rather than any single one of them.
    • TOP_LEFT

      public static final UI.Corner TOP_LEFT
      The top left corner.
    • TOP_RIGHT

      public static final UI.Corner TOP_RIGHT
      The top right corner.
    • BOTTOM_LEFT

      public static final UI.Corner BOTTOM_LEFT
      The bottom left corner.
    • BOTTOM_RIGHT

      public static final UI.Corner BOTTOM_RIGHT
      The bottom right corner.
  • Method Details

    • values

      public static UI.Corner[] 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.Corner 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
    • opposite

      public UI.Corner opposite()
      Returns the corner diagonally across the component from this one.
      Returns:
      BOTTOM_RIGHT for TOP_LEFT and so on, with EVERY returning itself, because it names no single corner.
    • toPlacement

      public UI.Placement toPlacement()
      Returns the point at this corner, which is how a corner is handed to the parts of the API that place things by UI.Placement, such as ImageConf.placement(Placement).
      Returns:
      The matching corner of UI.Placement, and UI.Placement.UNDEFINED for EVERY, which names no single corner.