org.gnome.gdk

## Class EventKey

- Object
- - org.freedesktop.bindings.Pointer
  - - org.gnome.glib.Boxed
    - - org.gnome.gdk.Event
      - - org.gnome.gdk.EventKey

-     public final class EventKey
      extends Event

  Event data describing a key press.
  Since:
    4.0.6
  Author:
    Andrew Cowie

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Keyval` | `getKeyval()` Get the key that was pressed.
    `ModifierType` | `getState()` Get the Flags object representing what modifiers are being held down, if any.

    - ### Methods inherited from class org.gnome.gdk.Event

      `getType, getWindow`

    - ### Methods inherited from class org.freedesktop.bindings.Pointer

      `toString`

    - ### Methods inherited from class Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### getKeyval

          public Keyval getKeyval()

      Get the key that was pressed.
      Since:
        4.0.6

    - #### getState

          public ModifierType getState()

      Get the Flags object representing what modifiers are being held down, if any.

      If you're only expecting a single modifier to be pressed then you could compare by equality:

           if (mod == ModifierType.SHIFT_MASK) {
               ...
           }

      but if you're looking for more complex combinations, or worried that more than one modifier could be down, then use `contains()`:

           if (mod.contains(ModifierType.CONTROL_MASK)) {
               ...
           }

      which will always do what you want.
      Since:
        4.0.6