com.jmex.bui.event
Class KeyEvent

java.lang.Object
  extended by java.util.EventObject
      extended by com.jmex.bui.event.BEvent
          extended by com.jmex.bui.event.InputEvent
              extended by com.jmex.bui.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
protected  char _keyChar
           
protected  int _keyCode
           
protected  int _type
           
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.jmex.bui.event.InputEvent
_modifiers, ALT_DOWN_MASK, BUTTON1_DOWN_MASK, BUTTON2_DOWN_MASK, BUTTON3_DOWN_MASK, CTRL_DOWN_MASK, META_DOWN_MASK, SHIFT_DOWN_MASK
 
Fields inherited from class com.jmex.bui.event.BEvent
_when
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
KeyEvent(Object source, long when, int modifiers, int type, char keyChar, int keyCode)
           
 
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.
protected  void toString(StringBuffer buf)
           
 
Methods inherited from class com.jmex.bui.event.InputEvent
getModifiers
 
Methods inherited from class com.jmex.bui.event.BEvent
getWhen, propagateUpHierarchy, toString
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, 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

_type

protected int _type

_keyChar

protected char _keyChar

_keyCode

protected int _keyCode
Constructor Detail

KeyEvent

public KeyEvent(Object source,
                long when,
                int modifiers,
                int type,
                char keyChar,
                int keyCode)
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:
KeyInput

dispatch

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

Overrides:
dispatch in class BEvent

toString

protected void toString(StringBuffer buf)
Overrides:
toString in class InputEvent


Copyright © 2008 Michael Bayne. All Rights Reserved.