public class KeyCode
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
ALT_BIT_MASK
Extended key state bit masks
|
int |
code
Key code value
|
static int |
CTRL_BIT_MASK |
static int |
META_BIT_MASK |
static int |
RELEASED_BIT_MASK |
static int |
SHIFT_BIT_MASK |
int |
state
Extended key state
|
| Constructor and Description |
|---|
KeyCode(int code)
Constructor.
|
KeyCode(int code,
boolean alt,
boolean ctrl,
boolean shift,
boolean meta)
Constructor.
|
KeyCode(int code,
boolean alt,
boolean ctrl,
boolean shift,
boolean meta,
boolean released)
Constructor.
|
KeyCode(int code,
int state)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
isAlt(int state)
Returns the Alt key state based on the supplied extended key state value.
|
static boolean |
isCtrl(int state)
Returns the Ctrl key state based on the supplied extended key state value.
|
static boolean |
isMeta(int state)
Returns the Meta key state based on the supplied extended key state value.
|
static boolean |
isReleased(int state)
Returns the Released key state based on the supplied extended key state value.
|
static boolean |
isShift(int state)
Returns the Shift key state based on the supplied extended key state value.
|
static int |
keyState(boolean alt,
boolean ctrl,
boolean shift,
boolean meta,
boolean released)
Build key state value from the supplied key states.
|
java.lang.String |
toString()
Returns a string representation of the object.
|
public static final int ALT_BIT_MASK
public static final int CTRL_BIT_MASK
public static final int SHIFT_BIT_MASK
public static final int META_BIT_MASK
public static final int RELEASED_BIT_MASK
public int code
public int state
public KeyCode(int code)
code - Key code value.public KeyCode(int code,
int state)
code - Key code value.state - Extended key state. See ALT_BIT_MASK, CTRL_BIT_MASK, SHIFT_BIT_MASK,
META_BIT_MASK for the expected bit.public KeyCode(int code,
boolean alt,
boolean ctrl,
boolean shift,
boolean meta)
code - Key code value.alt - The expected Alt key state, true for down, false for up.ctrl - The expected Ctrl key state, true for down, false for up.shift - The expected Shift key state, true for down, false for up.meta - The expected Meta key state, true for down, false for up.public KeyCode(int code,
boolean alt,
boolean ctrl,
boolean shift,
boolean meta,
boolean released)
code - Key code value.alt - The expected Alt key state, true for down, false for up.ctrl - The expected Ctrl key state, true for down, false for up.shift - The expected Shift key state, true for down, false for up.meta - The expected Meta key state, true for down, false for up.released - The expected Released key state,
true if code generated by a key release, false otherwise.public static boolean isAlt(int state)
state - Extended key state value.true for key down, false for key up.public static boolean isCtrl(int state)
state - Extended key state value.true for key down, false for key up.public static boolean isShift(int state)
state - Extended key state value.true for key down, false for key up.public static boolean isMeta(int state)
state - Extended key state value.true for key down, false for key up.public static boolean isReleased(int state)
state - Extended key state value.true for released keys, false otherwise.public static int keyState(boolean alt,
boolean ctrl,
boolean shift,
boolean meta,
boolean released)
alt - Alt key state, true for key down, false for key up.ctrl - Ctrk key state, true for key down, false for key up.shift - Shift key state, true for key down, false for key up.meta - Meta key state, true for key down, false for key up.public java.lang.String toString()
toString method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
toString in class java.lang.Object