com.jmex.bui.event
Class KeyEvent
java.lang.Object
java.util.EventObject
com.jmex.bui.event.BEvent
com.jmex.bui.event.InputEvent
com.jmex.bui.event.KeyEvent
- All Implemented Interfaces:
- java.io.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.BEvent |
_when |
| Fields inherited from class java.util.EventObject |
source |
|
Constructor Summary |
KeyEvent(java.lang.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(java.lang.StringBuffer buf)
|
| 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 |
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
KeyEvent
public KeyEvent(java.lang.Object source,
long when,
int modifiers,
int type,
char keyChar,
int keyCode)
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(java.lang.StringBuffer buf)
- Overrides:
toString in class InputEvent
Copyright © 2011 Michael Bayne.
All Rights Reserved.