Class KeyEvent2
- java.lang.Object
-
- com.realtime.crossfire.jxclient.gui.keybindings.KeyEvent2
-
public class KeyEvent2 extends java.lang.ObjectRepresents a pressed or released key.
-
-
Field Summary
Fields Modifier and Type Field Description static intALTThe mask for "shift".static intALT_GRAPHThe mask for "alt_graph".static intCTRLThe mask for "ctrl".static intMASKThe mask for all used modifiers.static intMETAThe mask for "meta".static intNONEThe mask for "no modifier".static intSHIFTThe mask for "shift".
-
Constructor Summary
Constructors Constructor Description KeyEvent2(int keyCode, char keyChar, int modifiers)Creates a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static intconvertModifiers(int modifiers)Converts old-style modifiers into the current format.booleanequals(@Nullable java.lang.Object obj)booleanequalsKeyCode(@NotNull KeyEvent2 keyEvent)Returns whether this key event matches the same key code as another key event.chargetKeyChar()Returns the key as a char.intgetKeyCode()Returns the key code.intgetModifiers()Returns the modifiers.inthashCode()static @NotNull java.lang.StringmodifiersToString(int modifiers)Converts modifiers to string representation.static intstringToModifiers(@NotNull java.lang.String modifiers)Converts a string representation to modifiers.@NotNull java.lang.StringtoString()
-
-
-
Field Detail
-
NONE
public static final int NONE
The mask for "no modifier".- See Also:
- Constant Field Values
-
ALT
public static final int ALT
The mask for "shift".- See Also:
- Constant Field Values
-
ALT_GRAPH
public static final int ALT_GRAPH
The mask for "alt_graph".- See Also:
- Constant Field Values
-
CTRL
public static final int CTRL
The mask for "ctrl".- See Also:
- Constant Field Values
-
META
public static final int META
The mask for "meta".- See Also:
- Constant Field Values
-
SHIFT
public static final int SHIFT
The mask for "shift".- See Also:
- Constant Field Values
-
MASK
public static final int MASK
The mask for all used modifiers.- See Also:
- Constant Field Values
-
-
Method Detail
-
getKeyCode
public int getKeyCode()
Returns the key code. SeeVK_xxxconstants.- Returns:
- the key code
-
getKeyChar
public char getKeyChar()
Returns the key as a char.- Returns:
- the key as a char
-
getModifiers
public int getModifiers()
- Returns:
- the modifiers
-
equalsKeyCode
public boolean equalsKeyCode(@NotNull @NotNull KeyEvent2 keyEvent)Returns whether this key event matches the same key code as another key event.- Parameters:
keyEvent- the other key event- Returns:
- whether both instances match the same key code
-
equals
public boolean equals(@Nullable @Nullable java.lang.Object obj)- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
@NotNull public @NotNull java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
convertModifiers
public static int convertModifiers(int modifiers)
Converts old-style modifiers into the current format.- Parameters:
modifiers- the old-style modifiers- Returns:
- the current format
-
modifiersToString
@NotNull public static @NotNull java.lang.String modifiersToString(int modifiers)
Converts modifiers to string representation.- Parameters:
modifiers- the modifiers- Returns:
- the string representation
-
stringToModifiers
public static int stringToModifiers(@NotNull @NotNull java.lang.String modifiers)Converts a string representation to modifiers. If the string representation is invalid, a warning is printed and the invalid part is ignored.- Parameters:
modifiers- the string representation- Returns:
- the modifiers
-
-