public final class KeyEvent extends Object implements IInputEvent, AutoCloseable
IInputEvent
that represents keyboard input.
This class contains the button state, the key and the modifiers if any.
Constructor and Description |
---|
KeyEvent(ButtonState state,
KeyCode key,
ModifierKeys modifierKeys)
Creates a key event.
|
KeyEvent(ButtonState state,
KeyCode key,
ModifierKeys modifierKeys,
Coordinate lastKnownLocation)
Creates a key event.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected void |
finalize() |
KeyCode |
getKey() |
Coordinate |
getLastKnownLocation() |
ModifierKeys |
getModifierKeys() |
ButtonState |
getState() |
public KeyEvent(@NotNull ButtonState state, @NotNull KeyCode key, @NotNull ModifierKeys modifierKeys)
state
- The state of the key.key
- The key of the event.modifierKeys
- The modifiers of the event.public KeyEvent(@NotNull ButtonState state, @NotNull KeyCode key, @NotNull ModifierKeys modifierKeys, @NotNull Coordinate lastKnownLocation)
state
- The state of the key.key
- The key of the event.modifierKeys
- The modifiers of the event.lastKnownLocation
- The last known location of the mousepublic void close()
close
in interface AutoCloseable
@NotNull public ButtonState getState()
@NotNull public KeyCode getKey()
@NotNull public ModifierKeys getModifierKeys()
@Nullable public Coordinate getLastKnownLocation()