org.gnu.gtk.event
Class KeyEvent
- Serializable
This event object is used to identify when a key has been pressed and
released. In particular, it allows you to get at
which key was
pressed - see
getKeyval()
.
KeyEvent
public KeyEvent(Object source,
KeyEvent.Type type,
EventKey gdkEvent)
Construct a KeyEvent object.
getKeyval
public int getKeyval()
Returns the key value. Example:
if (key == KeyValue.Return) {
...
}
- an int, the key value. See
KeyValue
for the
comprehensive list of values.
getLength
public int getLength()
Returns the length of the String that resulted from this keypress (see
getString()
).
getModifierKey
public ModifierType getModifierKey()
Returns the modifier key used.
getString
public String getString()
Get the "null-terminated multi-byte string containing the composed
characters resulting from the key press".
FIXME:
Isn't null termination hidden in Java? And, in any
case, characters in Strings in Java are multi-byte. So does this
work right nor not?
- String the character(s) resulting from the key press.
isOfType
public boolean isOfType(KeyEvent.Type test)
Test to compare events.