Xj3D 2.0 VRML/X3D Code API

org.web3d.vrml.util
Class Xj3DKeyEvent

java.lang.Object
  extended by java.util.EventObject
      extended by org.web3d.vrml.util.Xj3DKeyEvent
All Implemented Interfaces:
java.io.Serializable

public class Xj3DKeyEvent
extends java.util.EventObject

A key event object modeled on the awt and swt key event objects. This class has been developed for use within the X3D KeySensor and StringSensor node implementations to ensure independence from a specific ui toolkit implementation. This class is limited in capability to delivering key characters and identifying the few non-character generating keys that are specifically required by the X3D spec.

Version:
$Revision: 1.1 $
Author:
Rex Melton
See Also:
Serialized Form

Field Summary
static char CHAR_UNDEFINED
          The constant defining that no character is associated with the key
static int KEY_PRESSED
          The constant defining a key pressed event
static int KEY_RELEASED
          The constant defining a key released event
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
Xj3DKeyEvent(java.lang.Object src, int id, char c, int code)
          Constructor for a character associated event.
 
Method Summary
 int getID()
          Return the event identifier.
 char getKeyChar()
          Returns the character associated with the key that generated this event.
 int getKeyCode()
          Returns the key identifier code associated with the key that generated this event.
 boolean isAction()
          Returns whether the key that generated this event is a defined action key.
 boolean isBackspaceKey()
          Returns whether the character associated with the key that generated this event is the Backspace key.
 boolean isCharacter()
          Returns whether there is a character associated with the key that generated this event.
 boolean isEnterKey()
          Returns whether the character associated with the key that generated this event is the Enter key.
 boolean isModifier()
          Returns whether the key that generated this event is a defined modifer key.
 
Methods inherited from class java.util.EventObject
getSource, toString
 
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
The constant defining a key pressed event

See Also:
Constant Field Values

KEY_RELEASED

public static final int KEY_RELEASED
The constant defining a key released event

See Also:
Constant Field Values

CHAR_UNDEFINED

public static final char CHAR_UNDEFINED
The constant defining that no character is associated with the key

See Also:
Constant Field Values
Constructor Detail

Xj3DKeyEvent

public Xj3DKeyEvent(java.lang.Object src,
                    int id,
                    char c,
                    int code)
Constructor for a character associated event. If the argument character equals the NO_CHARACTER constant, the getKeyChar() method will return NO_CHARACTER and the isCharacter() method will return false. Otherwise, the getKeyChar() method will return the argument character and the isCharacter() method will return true.

Parameters:
src - the object that was the source of the event
id - the event id, either KEY_PRESSED or KEY_RELEASED.
c - the character associated with the key.
code - the identifier of the specific defined function of this character associated key event.
Method Detail

getID

public int getID()
Return the event identifier.

Returns:
the event identifier, either KEY_PRESSED or KEY_RELEASED.

isCharacter

public boolean isCharacter()
Returns whether there is a character associated with the key that generated this event.


isEnterKey

public boolean isEnterKey()
Returns whether the character associated with the key that generated this event is the Enter key.


isBackspaceKey

public boolean isBackspaceKey()
Returns whether the character associated with the key that generated this event is the Backspace key.


getKeyChar

public char getKeyChar()
Returns the character associated with the key that generated this event. If no character is associated, then the NO_CHARACTER constant is returned.


getKeyCode

public int getKeyCode()
Returns the key identifier code associated with the key that generated this event. If no key identifier code is associated, then the NO_KEY_CODE constant is returned.


isAction

public boolean isAction()
Returns whether the key that generated this event is a defined action key.


isModifier

public boolean isModifier()
Returns whether the key that generated this event is a defined modifer key.


Xj3D 2.0 VRML/X3D Code API

Copyright © 2001 - 2006 Web3D Consortium