javax.rad.ui.event
Class Key

java.lang.Object
  extended by javax.rad.ui.event.Key

public final class Key
extends Object

Stores Key Event Data for Accelerator.

See Also:
KeyEvent

Method Summary
 boolean equals(Object pObject)
          Returns true if this object is identical to the specified object.
 boolean equals(UIKeyEvent pEvent)
          Returns true if the Key matches the given KeyEvent.
static Key getKey(char pKeyChar)
          Returns a shared instance of an Key that represents a KEY_TYPED event for the specified character.
static Key getKey(char pKeyChar, int pModifiers)
          Returns a shared instance of an Key, for the specified character.
 char getKeyChar()
          Returns the character for this Key.
 int getKeyCode()
          Returns the numeric key code for this Key.
 int getKeyEventType()
          Returns the type of KeyEvent which corresponds to this Key.
static Key getKeyOnPressed(int pKeyCode)
          Returns a shared instance of an Key that represents a KEY_PRESSED event for the specified key code.
static Key getKeyOnPressed(int pKeyCode, int pModifiers)
          Returns a shared instance of an Key, for the specified key code.
static Key getKeyOnReleased(int pKeyCode)
          Returns a shared instance of an Key that represents a KEY_RELEASED event for the specified key code.
static Key getKeyOnReleased(int pKeyCode, int pModifiers)
          Returns a shared instance of an Key, for the specified key code.
 int getModifiers()
          Returns the modifier keys for this Key.
 int hashCode()
          Returns a numeric value for this object that is likely to be unique, making it a good choice as the index value in a hash table.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

equals

public final boolean equals(Object pObject)
Returns true if this object is identical to the specified object.

Overrides:
equals in class Object
Parameters:
pObject - the Object to compare this object to
Returns:
true if the objects are identical

hashCode

public int hashCode()
Returns a numeric value for this object that is likely to be unique, making it a good choice as the index value in a hash table.

Overrides:
hashCode in class Object
Returns:
an int that represents this object

getKeyChar

public final char getKeyChar()
Returns the character for this Key.

Returns:
a char value

getKeyCode

public final int getKeyCode()
Returns the numeric key code for this Key.

Returns:
an int containing the key code value

getModifiers

public final int getModifiers()
Returns the modifier keys for this Key.

Returns:
an int containing the modifiers

getKeyEventType

public final int getKeyEventType()
Returns the type of KeyEvent which corresponds to this Key.

Returns:
KeyEvent.KEY_PRESSED, KeyEvent.KEY_TYPED, or KeyEvent.KEY_RELEASED

getKey

public static Key getKey(char pKeyChar)
Returns a shared instance of an Key that represents a KEY_TYPED event for the specified character.

Parameters:
pKeyChar - the character value for a keyboard key
Returns:
an Key object for that key

getKey

public static Key getKey(char pKeyChar,
                         int pModifiers)
Returns a shared instance of an Key, for the specified character. The modifiers Since these numbers are all different powers of two, any combination of them is an integer in which each bit represents a different modifier key. Use 0 to specify no modifiers.

Parameters:
pKeyChar - the Character for a keyboard character
pModifiers - a bitwise-ored combination of any modifiers
Returns:
an Key object for that key

getKeyOnPressed

public static Key getKeyOnPressed(int pKeyCode)
Returns a shared instance of an Key that represents a KEY_PRESSED event for the specified key code.

Parameters:
pKeyCode - the key code value for a keyboard key
Returns:
an Key object for that key

getKeyOnPressed

public static Key getKeyOnPressed(int pKeyCode,
                                  int pModifiers)
Returns a shared instance of an Key, for the specified key code. Note that the first parameter is of type Character rather than char. This is to avoid inadvertent clashes with calls to getKey(int keyCode, int modifiers). The modifiers Since these numbers are all different powers of two, any combination of them is an integer in which each bit represents a different modifier key. Use 0 to specify no modifiers.

Parameters:
pKeyCode - the key code for a keyboard character
pModifiers - a bitwise-ored combination of any modifiers
Returns:
an Key object for that key

getKeyOnReleased

public static Key getKeyOnReleased(int pKeyCode)
Returns a shared instance of an Key that represents a KEY_RELEASED event for the specified key code.

Parameters:
pKeyCode - the key code value for a keyboard key
Returns:
an Key object for that key

getKeyOnReleased

public static Key getKeyOnReleased(int pKeyCode,
                                   int pModifiers)
Returns a shared instance of an Key, for the specified key code. Note that the first parameter is of type Character rather than char. This is to avoid inadvertent clashes with calls to getKey(int keyCode, int modifiers). The modifiers Since these numbers are all different powers of two, any combination of them is an integer in which each bit represents a different modifier key. Use 0 to specify no modifiers.

Parameters:
pKeyCode - the key code for a keyboard character
pModifiers - a bitwise-ored combination of any modifiers
Returns:
an Key object for that key

equals

public boolean equals(UIKeyEvent pEvent)
Returns true if the Key matches the given KeyEvent.

Parameters:
pEvent - the KeyEvent
Returns:
true if the Key matches the given KeyEvent.
Throws:
NullPointerException - if anEvent is null


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.