Package org.apache.pivot.wtk
Enum Keyboard.Modifier
- java.lang.Object
-
- java.lang.Enum<Keyboard.Modifier>
-
- org.apache.pivot.wtk.Keyboard.Modifier
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<Keyboard.Modifier>
- Enclosing class:
- Keyboard
public static enum Keyboard.Modifier extends java.lang.Enum<Keyboard.Modifier>
Enumeration representing keyboard modifiers.
-
-
Field Summary
Fields Modifier and Type Field Description static Set<Keyboard.Modifier>
ALL_MODIFIERS
The set of all possible keyboard modifiers (for use withKeyboard.isPressed(org.apache.pivot.wtk.Keyboard.Modifier)
, orgetMask(Set)
,Keyboard.areAllPressed(Set)
, orKeyboard.areAnyPressed(Set)
).
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Keyboard.Modifier
decode(java.lang.String input)
Convert the input string into one of our enum values.static int
getAWTMask(int mask)
Determine the complete set of AWT modifiers for a set of mask values.int
getMask()
static int
getMask(Set<Keyboard.Modifier> modifiers)
Determine the complete mask for all the given modifiers.static int
getMask(Keyboard.Modifier... modifiers)
Determine the complete mask for all the given modifiers.static int
getModifiers(int awtModifiers, int keyLocation)
Determine the complete set of our modifier masks that are represented by the given AWT modifiers set.static Keyboard.Modifier
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static Keyboard.Modifier[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
SHIFT
public static final Keyboard.Modifier SHIFT
-
CTRL
public static final Keyboard.Modifier CTRL
-
ALT
public static final Keyboard.Modifier ALT
-
META
public static final Keyboard.Modifier META
-
-
Field Detail
-
ALL_MODIFIERS
public static final Set<Keyboard.Modifier> ALL_MODIFIERS
The set of all possible keyboard modifiers (for use withKeyboard.isPressed(org.apache.pivot.wtk.Keyboard.Modifier)
, orgetMask(Set)
,Keyboard.areAllPressed(Set)
, orKeyboard.areAnyPressed(Set)
).
-
-
Method Detail
-
values
public static Keyboard.Modifier[] 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 (Keyboard.Modifier c : Keyboard.Modifier.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Keyboard.Modifier 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 modifier, which is
2**ordinal
.
-
getMask
public static int getMask(Set<Keyboard.Modifier> modifiers)
Determine the complete mask for all the given modifiers.- Parameters:
modifiers
- The set of modifiers to test.- Returns:
- The complete mask corresponding to the set.
-
getMask
public static int getMask(Keyboard.Modifier... modifiers)
Determine the complete mask for all the given modifiers.- Parameters:
modifiers
- The list of modifiers to test.- Returns:
- The complete mask corresponding to the list.
-
getAWTMask
public static int getAWTMask(int mask)
Determine the complete set of AWT modifiers for a set of mask values.- Parameters:
mask
- The complete mask set of our modifiers.- Returns:
- The complete mask for AWT use.
-
getModifiers
public static int getModifiers(int awtModifiers, int keyLocation)
Determine the complete set of our modifier masks that are represented by the given AWT modifiers set.- Parameters:
awtModifiers
- The set of modifiers returned byInputEvent.getModifiersEx()
.keyLocation
- Where the key event originated (used to modify/ignore some modifiers).- Returns:
- The complete mask of the our modifiers represented by the input.
-
decode
public static Keyboard.Modifier decode(java.lang.String input)
Convert the input string into one of our enum values.- Parameters:
input
- Should be one of the enum constants, but we will also recognize the constant regardless of case, and also allow the Unicode character equivalent to be valid.- Returns:
- The enum value corresponding to the input.
- Throws:
java.lang.IllegalArgumentException
- if the input cannot be recognizedjava.lang.NullPointerException
- if the input value isnull
-
-