com.threerings.opengl.gui.event
Class KeyEvent

java.lang.Object
  extended by java.util.EventObject
      extended by com.threerings.opengl.gui.event.Event
          extended by com.threerings.opengl.gui.event.InputEvent
              extended by com.threerings.opengl.gui.event.KeyEvent
All Implemented Interfaces:
Serializable

public class KeyEvent
extends InputEvent

Encapsulates the information associated with a keyboard event.

See Also:
Serialized Form

Field Summary
static int KEY_PRESSED
          Indicates that an event represents a key pressing.
static int KEY_RELEASED
          Indicates that an event represents a key release.
 
Fields inherited from class com.threerings.opengl.gui.event.InputEvent
ALT_DOWN_MASK, BUTTON1_DOWN_MASK, BUTTON2_DOWN_MASK, BUTTON3_DOWN_MASK, CTRL_DOWN_MASK, META_DOWN_MASK, SHIFT_DOWN_MASK
 
Constructor Summary
KeyEvent(Object source, long when, int modifiers, int type, char keyChar, int keyCode, boolean repeat)
           
 
Method Summary
 void dispatch(ComponentListener listener)
          Instructs this event to notify the supplied listener if they implement an interface appropriate to this event.
 char getKeyChar()
          Returns the character associated with the key.
 int getKeyCode()
          Returns the numeric identifier associated with the key.
 int getType()
          Indicates whether this was a KEY_PRESSED or KEY_RELEASED event.
 boolean isRepeat()
          Checks whether this is a repeat (press) event.
 
Methods inherited from class com.threerings.opengl.gui.event.InputEvent
getModifiers, isAltDown, isControlDown, isMetaDown, isShiftDown
 
Methods inherited from class com.threerings.opengl.gui.event.Event
consume, getWhen, isConsumed, propagateUpHierarchy, toString
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

KEY_PRESSED

public static final int KEY_PRESSED
Indicates that an event represents a key pressing.

See Also:
Constant Field Values

KEY_RELEASED

public static final int KEY_RELEASED
Indicates that an event represents a key release.

See Also:
Constant Field Values
Constructor Detail

KeyEvent

public KeyEvent(Object source,
                long when,
                int modifiers,
                int type,
                char keyChar,
                int keyCode,
                boolean repeat)
Method Detail

getType

public int getType()
Indicates whether this was a KEY_PRESSED or KEY_RELEASED event.


getKeyChar

public char getKeyChar()
Returns the character associated with the key. Note: this is only valid for KEY_PRESSED events, however getKeyCode() works in all cases.


getKeyCode

public int getKeyCode()
Returns the numeric identifier associated with the key.

See Also:
Keyboard

isRepeat

public boolean isRepeat()
Checks whether this is a repeat (press) event.


dispatch

public void dispatch(ComponentListener listener)
Description copied from class: Event
Instructs this event to notify the supplied listener if they implement an interface appropriate to this event.

Overrides:
dispatch in class Event


Copyright © 2011. All Rights Reserved.