Class KeyEvent

java.lang.Object
com.luciad.input.KeyEvent
All Implemented Interfaces:
IInputEvent, AutoCloseable

public final class KeyEvent extends Object implements IInputEvent, AutoCloseable
Implementation of IInputEvent that represents keyboard input.

This class contains the button state, the key and the modifiers if any.

  • Constructor Details Link icon

    • KeyEvent Link icon

      public KeyEvent(@NotNull ButtonState state, @NotNull KeyCode key, @NotNull ModifierKeys modifierKeys)
      Creates a key event.
      Parameters:
      state - The state of the key.
      key - The key of the event.
      modifierKeys - The modifiers of the event.
    • KeyEvent Link icon

      public KeyEvent(@NotNull ButtonState state, @NotNull KeyCode key, @NotNull ModifierKeys modifierKeys, @NotNull Coordinate lastKnownLocation)
      Creates a key event.
      Parameters:
      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 mouse
  • Method Details Link icon

    • finalize Link icon

      protected void finalize()
      Overrides:
      finalize in class Object
    • close Link icon

      public void close()
      Specified by:
      close in interface AutoCloseable
    • getState Link icon

      @NotNull public ButtonState getState()
      Returns the state of the key.
      Returns:
      the state of the key.
    • getKey Link icon

      @NotNull public KeyCode getKey()
      Returns the key of the event.
      Returns:
      the key of the event.
    • getModifierKeys Link icon

      @NotNull public ModifierKeys getModifierKeys()
      Returns the modifiers of the event.
      Returns:
      the modifiers of the event.
    • getLastKnownLocation Link icon

      @Nullable public Coordinate getLastKnownLocation()
      Returns the last know location of the input device (for example the mouse cursor) when this event occurred.

      It is expressed in screen coordinates (px) with top-left corner of the map being the (0,0) position.

      Returns:
      the last know location of the input device when this event occurred.