Package org.apache.pivot.wtk
Enum Mouse.Button
- java.lang.Object
-
- java.lang.Enum<Mouse.Button>
-
- org.apache.pivot.wtk.Mouse.Button
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<Mouse.Button>
- Enclosing class:
- Mouse
public static enum Mouse.Button extends java.lang.Enum<Mouse.Button>
Enumeration representing mouse buttons.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Mouse.Button
getButton(int eventButton)
Translate the AWT mouse event button to our own button value.static int
getButtons(int modifiers)
Figure out the complete mask of our button values, given an AWT input event set of mouse button modifiers.int
getMask()
static Mouse.Button
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static Mouse.Button[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
LEFT
public static final Mouse.Button LEFT
The left mouse button (typically the "main" button for clicks, etc).
-
RIGHT
public static final Mouse.Button RIGHT
The right mouse button (typically for popup menus and such).
-
MIDDLE
public static final Mouse.Button MIDDLE
The middle mouse button (not used much here).
-
-
Method Detail
-
values
public static Mouse.Button[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (Mouse.Button c : Mouse.Button.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Mouse.Button valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
getMask
public int getMask()
- Returns:
- The one-bit mask for this button, which is
2**ordinal
.
-
getButtons
public static int getButtons(int modifiers)
Figure out the complete mask of our button values, given an AWT input event set of mouse button modifiers.- Parameters:
modifiers
- The set ofInputEvent
modifiers.- Returns:
- The corresponding mask of our own button values.
-
getButton
public static Mouse.Button getButton(int eventButton)
Translate the AWT mouse event button to our own button value.- Parameters:
eventButton
- TheMouseEvent
button value.- Returns:
- The corresponding enum value, or
null
if there is no correspondence (should never happen).
-
-