Package org.web3d.vrml.util
Class Xj3DKeyEvent
java.lang.Object
java.util.EventObject
org.web3d.vrml.util.Xj3DKeyEvent
- All Implemented Interfaces:
Serializable
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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final char
The constant defining that no character is associated with the keystatic final int
The constant defining a key pressed eventstatic final int
The constant defining a key released eventFields inherited from class java.util.EventObject
source
-
Constructor Summary
ConstructorsConstructorDescriptionXj3DKeyEvent
(Object src, int id, char c, int code) Constructor for a character associated event. -
Method Summary
Modifier and TypeMethodDescriptionint
getID()
Return the event identifier.char
Returns the character associated with the key that generated this event.int
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
Returns whether the character associated with the key that generated this event is the Backspace key.boolean
Returns whether there is a character associated with the key that generated this event.boolean
Returns whether the character associated with the key that generated this event is the Enter key.boolean
Returns whether the key that generated this event is a defined modifier key.Methods inherited from class java.util.EventObject
getSource, toString
-
Field Details
-
KEY_PRESSED
public static final int KEY_PRESSEDThe constant defining a key pressed event- See Also:
-
KEY_RELEASED
public static final int KEY_RELEASEDThe constant defining a key released event- See Also:
-
CHAR_UNDEFINED
public static final char CHAR_UNDEFINEDThe constant defining that no character is associated with the key- See Also:
-
-
Constructor Details
-
Xj3DKeyEvent
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 eventid
- 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 Details
-
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.- Returns:
-
isEnterKey
public boolean isEnterKey()Returns whether the character associated with the key that generated this event is the Enter key.- Returns:
-
isBackspaceKey
public boolean isBackspaceKey()Returns whether the character associated with the key that generated this event is the Backspace key.- Returns:
-
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.- Returns:
-
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.- Returns:
-
isAction
public boolean isAction()Returns whether the key that generated this event is a defined action key.- Returns:
-
isModifier
public boolean isModifier()Returns whether the key that generated this event is a defined modifier key.- Returns:
-