public final class EventKey extends Event
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.
|
public Keyval getKeyval()
public ModifierType getState()
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.