Package org.apache.pivot.wtk
Class Keyboard.KeyStroke
- java.lang.Object
-
- org.apache.pivot.wtk.Keyboard.KeyStroke
-
- Enclosing class:
- Keyboard
public static final class Keyboard.KeyStroke extends java.lang.Object
Represents a keystroke, a combination of a keycode and modifier flags.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
COMMAND_ABBREVIATION
-
Constructor Summary
Constructors Constructor Description KeyStroke(int code, int modifiers)
Construct from a key code and the bit mask of the desired modifiers.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Keyboard.KeyStroke
decode(java.lang.String value)
Decode a keystroke value from its string representation.boolean
equals(java.lang.Object object)
int
getKeyCode()
int
getModifiers()
int
hashCode()
java.lang.String
toString()
-
-
-
Field Detail
-
COMMAND_ABBREVIATION
public static final java.lang.String COMMAND_ABBREVIATION
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
KeyStroke
public KeyStroke(int code, int modifiers)
Construct from a key code and the bit mask of the desired modifiers.- Parameters:
code
- The key code desired.modifiers
- The bit mask of modifiers to use.- See Also:
Keyboard.KeyCode
,Keyboard.Modifier
-
-
Method Detail
-
getKeyCode
public int getKeyCode()
- Returns:
- The key code associated with this keystroke.
-
getModifiers
public int getModifiers()
- Returns:
- The bit mask of modifiers associated with this keystroke.
-
equals
public boolean equals(java.lang.Object object)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
decode
public static Keyboard.KeyStroke decode(java.lang.String value)
Decode a keystroke value from its string representation.- Parameters:
value
- Input value, such as"Cmd-F1"
,"Ctrl+Shift+Left"
, or even"⌃⌘F1"
.- Returns:
- The corresponding
KeyStroke
value. - Throws:
java.lang.IllegalArgumentException
- if the input string cannot be decoded.
-
-