net.nexttext.input
Class KeyboardEvent

java.lang.Object
  extended by net.nexttext.input.InputEvent
      extended by net.nexttext.input.KeyboardEvent
All Implemented Interfaces:
java.io.Serializable

public class KeyboardEvent
extends InputEvent

An event generated by the keyboard.

This is a wrapper around the KeyEvent class. All IDs returned by the functions of this class are the same IDs used in the KeyEvent class.

See Also:
Serialized Form

Constructor Summary
KeyboardEvent(java.awt.event.KeyEvent event)
          Class constructor
 
Method Summary
 char getKeyChar()
          Returns the character associated with the key in this event.
 int getKeyCode()
          Returns the integer keyCode associated with the key in this event.
 int getKeyLocation()
          Returns the location of the key that originated this key event.
 int getType()
          Returns the type of keyboard event.
 boolean isActionKey()
          Returns whether the key in this event is an "action" key.
 boolean isAltDown()
          Returns whether or not the Alt modifier is down on this event.
 boolean isAltGraphDown()
          Returns whether or not the Alt Graph modifier is down on this event.
 boolean isControlDown()
          Returns whether or not the Control modifier is down on this event.
 boolean isMetaDown()
          Returns whether or not the Meta modifier is down on this event.
 boolean isShiftDown()
          Returns whether or not the Shift modifier is down on this event.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KeyboardEvent

public KeyboardEvent(java.awt.event.KeyEvent event)
Class constructor

Parameters:
event - the generated event
Method Detail

getType

public int getType()
Returns the type of keyboard event.

Returns:
the type id of the keyboard event

getKeyChar

public char getKeyChar()
Returns the character associated with the key in this event.

Returns:
a char corresponding to to the combination of keystrokes that make up this event.

getKeyCode

public int getKeyCode()
Returns the integer keyCode associated with the key in this event.

Returns:
the integer code for an actual key on the keyboard. (For KEY_TYPED events, the keyCode is VK_UNDEFINED.)

getKeyLocation

public int getKeyLocation()
Returns the location of the key that originated this key event.

Returns:
the location of the key that was pressed or released. Always returns KEY_LOCATION_UNKNOWN for KEY_TYPED events.

isActionKey

public boolean isActionKey()
Returns whether the key in this event is an "action" key.

Returns:
true if the key is an "action" key, false otherwise

isAltDown

public boolean isAltDown()
Returns whether or not the Alt modifier is down on this event.

Returns:
true if the alt key is down

isAltGraphDown

public boolean isAltGraphDown()
Returns whether or not the Alt Graph modifier is down on this event.

Returns:
true if the alt graph key is down

isControlDown

public boolean isControlDown()
Returns whether or not the Control modifier is down on this event.

Returns:
true if the control key is down

isMetaDown

public boolean isMetaDown()
Returns whether or not the Meta modifier is down on this event.

Returns:
true if the meta key is down

isShiftDown

public boolean isShiftDown()
Returns whether or not the Shift modifier is down on this event.

Returns:
true if the shift key is down