java-gnome version 4.0.19

org.gnome.gdk
Class EventKey

Object
  extended by org.freedesktop.bindings.Pointer
      extended by org.gnome.glib.Boxed
          extended by org.gnome.gdk.Event
              extended by 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
 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


java-gnome