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.ObjectRepresents a keystroke, a combination of a keycode and modifier flags.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCOMMAND_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.KeyStrokedecode(java.lang.String value)Decode a keystroke value from its string representation.booleanequals(java.lang.Object object)intgetKeyCode()intgetModifiers()inthashCode()java.lang.StringtoString()
-
-
-
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:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin 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
KeyStrokevalue. - Throws:
java.lang.IllegalArgumentException- if the input string cannot be decoded.
-
-