Package swingtree

Enum Class UI.Cursor

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

@Immutable public static enum UI.Cursor extends Enum<UI.Cursor> implements UIEnum<UI.Cursor>
Names the shape the mouse pointer takes while it is over a component, with one constant for every pointer shape Cursor predefines. AWT identifies those shapes by int constants, because it was written before Java had enums.

The eight resize constants are named after the side or the corner of the component a drag would move, rather than after a compass direction: RESIZE_BOTTOM_LEFT is the arrow AWT calls Cursor.SW_RESIZE_CURSOR. Code which already holds a UI.Side or a UI.Corner, such as the handler of a resize handle, can let resizeAt(Side) and resizeAt(Corner) pick the matching constant.

See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class java.lang.Enum

    Enum.EnumDesc<E extends Enum<E>>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    The crosshair, for picking an exact point.
    The ordinary arrow pointer, which is what a component shows unless it asks for something else.
    The pointing hand, for something the user can click through, like a link.
    The four way arrow, for something the user can drag to a new place.
    The arrow for a handle which moves the bottom edge of a component.
    The arrow for a handle which moves the bottom left corner of a component.
    The arrow for a handle which moves the bottom right corner of a component.
    The arrow for a handle which moves the left edge of a component.
    The arrow for a handle which moves the right edge of a component.
    The arrow for a handle which moves the top edge of a component.
    The arrow for a handle which moves the top left corner of a component.
    The arrow for a handle which moves the top right corner of a component.
    The upright bar shown over text which can be selected or typed into.
    The busy pointer, telling the user that the program is working and not listening.
  • Method Summary

    Modifier and Type
    Method
    Description
    static UI.Cursor
    Returns the cursor which tells the user that dragging will move the given corner of a component, so that code which already holds a UI.Corner can ask for the matching cursor instead of naming it a second time.
    static UI.Cursor
    Returns the cursor which tells the user that dragging will move the given side of a component, so that code which already holds a UI.Side can ask for the matching cursor instead of naming it a second time.
    Returns the Cursor AWT predefines for the pointer shape this constant names.
    static UI.Cursor
    Returns the enum constant of this class with the specified name.
    static UI.Cursor[]
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface swingtree.UIEnum

    isNoneOf, isNoneOf, isNoneOf, isOneOf, isOneOf, isOneOf
  • Enum Constant Details

    • DEFAULT

      public static final UI.Cursor DEFAULT
      The ordinary arrow pointer, which is what a component shows unless it asks for something else.
    • CROSS

      public static final UI.Cursor CROSS
      The crosshair, for picking an exact point.
    • TEXT

      public static final UI.Cursor TEXT
      The upright bar shown over text which can be selected or typed into.
    • WAIT

      public static final UI.Cursor WAIT
      The busy pointer, telling the user that the program is working and not listening.
    • RESIZE_TOP

      public static final UI.Cursor RESIZE_TOP
      The arrow for a handle which moves the top edge of a component. AWT calls it Cursor.N_RESIZE_CURSOR.
    • RESIZE_LEFT

      public static final UI.Cursor RESIZE_LEFT
      The arrow for a handle which moves the left edge of a component. AWT calls it Cursor.W_RESIZE_CURSOR.
    • RESIZE_BOTTOM

      public static final UI.Cursor RESIZE_BOTTOM
      The arrow for a handle which moves the bottom edge of a component. AWT calls it Cursor.S_RESIZE_CURSOR.
    • RESIZE_RIGHT

      public static final UI.Cursor RESIZE_RIGHT
      The arrow for a handle which moves the right edge of a component. AWT calls it Cursor.E_RESIZE_CURSOR.
    • RESIZE_TOP_LEFT

      public static final UI.Cursor RESIZE_TOP_LEFT
      The arrow for a handle which moves the top left corner of a component. AWT calls it Cursor.NW_RESIZE_CURSOR.
    • RESIZE_TOP_RIGHT

      public static final UI.Cursor RESIZE_TOP_RIGHT
      The arrow for a handle which moves the top right corner of a component. AWT calls it Cursor.NE_RESIZE_CURSOR.
    • RESIZE_BOTTOM_LEFT

      public static final UI.Cursor RESIZE_BOTTOM_LEFT
      The arrow for a handle which moves the bottom left corner of a component. AWT calls it Cursor.SW_RESIZE_CURSOR.
    • RESIZE_BOTTOM_RIGHT

      public static final UI.Cursor RESIZE_BOTTOM_RIGHT
      The arrow for a handle which moves the bottom right corner of a component. AWT calls it Cursor.SE_RESIZE_CURSOR.
    • HAND

      public static final UI.Cursor HAND
      The pointing hand, for something the user can click through, like a link.
    • MOVE

      public static final UI.Cursor MOVE
      The four way arrow, for something the user can drag to a new place.
  • Method Details

    • values

      public static UI.Cursor[] 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.Cursor 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
    • resizeAt

      public static UI.Cursor resizeAt(UI.Side side)
      Returns the cursor which tells the user that dragging will move the given side of a component, so that code which already holds a UI.Side can ask for the matching cursor instead of naming it a second time.
      Parameters:
      side - The side of the component whose size a drag would change.
      Returns:
      One of RESIZE_TOP, RESIZE_LEFT, RESIZE_BOTTOM or RESIZE_RIGHT.
    • resizeAt

      public static UI.Cursor resizeAt(UI.Corner corner)
      Returns the cursor which tells the user that dragging will move the given corner of a component, so that code which already holds a UI.Corner can ask for the matching cursor instead of naming it a second time.
      Parameters:
      corner - The corner of the component whose size a drag would change.
      Returns:
      One of RESIZE_TOP_LEFT, RESIZE_TOP_RIGHT, RESIZE_BOTTOM_LEFT or RESIZE_BOTTOM_RIGHT, and DEFAULT for UI.Corner.EVERY, which names no single corner.
    • toAWTCursor

      public Cursor toAWTCursor()
      Returns the Cursor AWT predefines for the pointer shape this constant names. AWT keeps one instance per shape and hands out that same instance every time, so assigning a cursor allocates nothing.
      Returns:
      The result of Cursor.getPredefinedCursor(int) for the cursor type this constant maps to.