Package swingtree
Enum Class UI.Cursor
- All Implemented Interfaces:
Serializable,Comparable<UI.Cursor>,Constable,UIEnum<UI.Cursor>
- Enclosing class:
UI
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 ConstantsEnum ConstantDescriptionThe 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 TypeMethodDescriptionstatic UI.CursorReturns the cursor which tells the user that dragging will move the given corner of a component, so that code which already holds aUI.Cornercan ask for the matching cursor instead of naming it a second time.static UI.CursorReturns the cursor which tells the user that dragging will move the given side of a component, so that code which already holds aUI.Sidecan ask for the matching cursor instead of naming it a second time.Returns theCursorAWT predefines for the pointer shape this constant names.static UI.CursorReturns the enum constant of this class with the specified name.static UI.Cursor[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
DEFAULT
The ordinary arrow pointer, which is what a component shows unless it asks for something else. -
CROSS
The crosshair, for picking an exact point. -
TEXT
The upright bar shown over text which can be selected or typed into. -
WAIT
The busy pointer, telling the user that the program is working and not listening. -
RESIZE_TOP
The arrow for a handle which moves the top edge of a component. AWT calls itCursor.N_RESIZE_CURSOR. -
RESIZE_LEFT
The arrow for a handle which moves the left edge of a component. AWT calls itCursor.W_RESIZE_CURSOR. -
RESIZE_BOTTOM
The arrow for a handle which moves the bottom edge of a component. AWT calls itCursor.S_RESIZE_CURSOR. -
RESIZE_RIGHT
The arrow for a handle which moves the right edge of a component. AWT calls itCursor.E_RESIZE_CURSOR. -
RESIZE_TOP_LEFT
The arrow for a handle which moves the top left corner of a component. AWT calls itCursor.NW_RESIZE_CURSOR. -
RESIZE_TOP_RIGHT
The arrow for a handle which moves the top right corner of a component. AWT calls itCursor.NE_RESIZE_CURSOR. -
RESIZE_BOTTOM_LEFT
The arrow for a handle which moves the bottom left corner of a component. AWT calls itCursor.SW_RESIZE_CURSOR. -
RESIZE_BOTTOM_RIGHT
The arrow for a handle which moves the bottom right corner of a component. AWT calls itCursor.SE_RESIZE_CURSOR. -
HAND
The pointing hand, for something the user can click through, like a link. -
MOVE
The four way arrow, for something the user can drag to a new place.
-
-
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
-
resizeAt
Returns the cursor which tells the user that dragging will move the given side of a component, so that code which already holds aUI.Sidecan 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_BOTTOMorRESIZE_RIGHT.
-
resizeAt
Returns the cursor which tells the user that dragging will move the given corner of a component, so that code which already holds aUI.Cornercan 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_LEFTorRESIZE_BOTTOM_RIGHT, andDEFAULTforUI.Corner.EVERY, which names no single corner.
-
toAWTCursor
Returns theCursorAWT 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.
-