Modifier and Type | Field and Description |
---|---|
static int |
ALT
The mask for "shift".
|
static int |
ALT_GRAPH
The mask for "alt_graph".
|
static int |
CTRL
The mask for "ctrl".
|
static int |
MASK
The mask for all used modifiers.
|
static int |
META
The mask for "meta".
|
static int |
NONE
The mask for "no modifier".
|
static int |
SHIFT
The mask for "shift".
|
Constructor and Description |
---|
KeyEvent2(int keyCode,
char keyChar,
int modifiers)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(@NotNull KeyEvent2 o) |
static int |
convertModifiers(int modifiers)
Converts old-style modifiers into the current format.
|
boolean |
equals(@Nullable java.lang.Object obj) |
char |
getKeyChar()
Returns the key as a char.
|
int |
getKeyCode()
Returns the key code.
|
int |
getModifiers()
Returns the modifiers.
|
int |
hashCode() |
boolean |
matchesKeyEvent(@NotNull KeyEvent2 keyEvent)
Returns whether this key event matches the same key code as another key
event.
|
static @NotNull java.lang.String |
modifiersToString(int modifiers)
Converts modifiers to string representation.
|
static int |
stringToModifiers(@NotNull java.lang.String modifiers)
Converts a string representation to modifiers.
|
@NotNull java.lang.String |
toString() |
public static final int NONE
public static final int ALT
public static final int ALT_GRAPH
public static final int CTRL
public static final int META
public static final int SHIFT
public static final int MASK
public KeyEvent2(int keyCode, char keyChar, int modifiers)
keyCode
- the key codekeyChar
- the key as a charmodifiers
- the modifierspublic int getKeyCode()
VK_xxx
constants.public char getKeyChar()
public int getModifiers()
public boolean matchesKeyEvent(@NotNull @NotNull KeyEvent2 keyEvent)
keyEvent
- the other key eventpublic boolean equals(@Nullable @Nullable java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public int compareTo(@NotNull @NotNull KeyEvent2 o)
compareTo
in interface java.lang.Comparable<KeyEvent2>
@NotNull public @NotNull java.lang.String toString()
toString
in class java.lang.Object
public static int convertModifiers(int modifiers)
modifiers
- the old-style modifiers@NotNull public static @NotNull java.lang.String modifiersToString(int modifiers)
modifiers
- the modifierspublic static int stringToModifiers(@NotNull @NotNull java.lang.String modifiers)
modifiers
- the string representation