org.gnu.gtk.event

Class KeyEvent

Implemented Interfaces:
Serializable

public class KeyEvent
extends GtkEvent

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().
See Also:
An example of how to listen for KeyEvents, KeyValue

Nested Class Summary

static class
KeyEvent.Type

Constructor Summary

KeyEvent(Object source, KeyEvent.Type type, EventKey gdkEvent)
Deprecated. Superceeded by java-gnome 4.0; Signals all have individual interfaces each with a single method corresponding to the signature of the underlying callback.

Method Summary

int
getKeyval()
Deprecated. Superceeded by java-gnome 4.0; Signals all have individual interfaces each with a single method corresponding to the signature of the underlying callback.
int
getLength()
Deprecated. Superceeded by java-gnome 4.0; Signals all have individual interfaces each with a single method corresponding to the signature of the underlying callback.
ModifierType
getModifierKey()
Deprecated. Superceeded by java-gnome 4.0; Signals all have individual interfaces each with a single method corresponding to the signature of the underlying callback.
String
getString()
Deprecated. Superceeded by java-gnome 4.0; Signals all have individual interfaces each with a single method corresponding to the signature of the underlying callback.
boolean
isOfType(KeyEvent.Type test)
Deprecated. Superceeded by java-gnome 4.0; Signals all have individual interfaces each with a single method corresponding to the signature of the underlying callback.

Methods inherited from class org.gnu.gtk.event.GtkEvent

getSource, getType, toString

Constructor Details

KeyEvent

public KeyEvent(Object source,
                KeyEvent.Type type,
                EventKey gdkEvent)

Deprecated. Superceeded by java-gnome 4.0; Signals all have individual interfaces each with a single method corresponding to the signature of the underlying callback.

Construct a KeyEvent object.

Method Details

getKeyval

public int getKeyval()

Deprecated. Superceeded by java-gnome 4.0; Signals all have individual interfaces each with a single method corresponding to the signature of the underlying callback.

Returns the key value. Example:
       if (key == KeyValue.Return) {
           ...
       }
 
Returns:
an int, the key value. See KeyValue for the comprehensive list of values.

getLength

public int getLength()

Deprecated. Superceeded by java-gnome 4.0; Signals all have individual interfaces each with a single method corresponding to the signature of the underlying callback.

Returns:
int

getModifierKey

public ModifierType getModifierKey()

Deprecated. Superceeded by java-gnome 4.0; Signals all have individual interfaces each with a single method corresponding to the signature of the underlying callback.

Returns the modifier key used.
Returns:
(see ModifierType)

getString

public String getString()

Deprecated. Superceeded by java-gnome 4.0; Signals all have individual interfaces each with a single method corresponding to the signature of the underlying callback.

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?

Returns:
String the character(s) resulting from the key press.

isOfType

public boolean isOfType(KeyEvent.Type test)

Deprecated. Superceeded by java-gnome 4.0; Signals all have individual interfaces each with a single method corresponding to the signature of the underlying callback.

Test to compare events.