public class KeyBinding extends java.lang.Object implements java.lang.Comparable<KeyBinding>
This class represents a key binding, consisting of a key code and modifiers like SHIFT, CTRL and so on.
Modifier and Type | Field and Description |
---|---|
private int |
keycode |
private int |
modifiers |
Constructor and Description |
---|
KeyBinding(int code,
int mods)
Creates a new key binding.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(KeyBinding o) |
java.lang.String |
getDescription()
Returns a human-readable description of the key binding.
|
int |
getKeyCode()
Returns the key code.
|
int |
getModifiers()
Returns a value representing the pressed modifiers (SHIFT, CTRL, and so on), connected with bitwise-OR.
|
java.lang.String |
toString()
Returns a string containing the key code and the modifiers.
|
public KeyBinding(int code, int mods)
Creates a new key binding.
code
- key codemods
- modifiers like SHIFT, CTRL, and so on, connected with bitwise-ORpublic int getKeyCode()
Returns the key code.
public int getModifiers()
Returns a value representing the pressed modifiers (SHIFT, CTRL, and so on), connected with bitwise-OR.
public java.lang.String toString()
Returns a string containing the key code and the modifiers. Each key binding with the same combination of keycode and modifiers returns the same string.
toString
in class java.lang.Object
public java.lang.String getDescription()
Returns a human-readable description of the key binding.
public int compareTo(KeyBinding o)
compareTo
in interface java.lang.Comparable<KeyBinding>