|
GF4J 0.9.4 Beta | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gameframe.engines.jdk11x.CKeyboard
Implementation of the keyboard device for Java 1.1 platform.
Field Summary | |
private static int |
KEY_DOWN
Enumerated value for state key is down. |
private static int |
KEY_UP
Enumerated value for state key is up. |
private static int |
KEY_WAS_DOWN_NOT_READ
Enumerated value for state where key was down but was not read during that time. |
private static int |
KEY_WAS_DOWN_READ
Enumerated value for state where key was down and was read during that time. |
private int[] |
m_aKeyStates
States of the keys. |
private int[] |
m_aNumKeystrokes
Number of times the key was stroken. |
private java.awt.Component |
m_focusComponent
Reference to the focus component that is the source of keyboard events. |
private int |
m_lastAlphanumericKey
The last alphanumeric key value typed. |
Constructor Summary | |
(package private) |
CKeyboard(java.awt.Component component)
Constructs a keyboard engine that has the given component set as the focus component. |
Method Summary | |
void |
finalize()
Releases all resources held by the keyboard device implementation. |
int |
getKeyDownCount(int keyCode)
Returns the number of times the key has been stroken since last reading (after last call made to isKeyDown or getKeyDownCount methods with the same key code). |
int |
getTypedAlphanumericKey()
Returns any typed alphanumeric keys (including space and dot) as int values that correspond to that keys char value or -1 if no such keys were pressed after last invokation of this method. |
boolean |
isKeyDown(int keyCode)
Returns true if the key is currently down |
void |
keyPressed(java.awt.event.KeyEvent event)
|
void |
keyReleased(java.awt.event.KeyEvent event)
|
void |
keyTyped(java.awt.event.KeyEvent event)
|
boolean |
wasKeyDown(int keyCode)
Returns true if the key was briefly kept down after last reading of the keys state (after last call made to isKeyDown or getKeyDownCount methods with the same key code). |
Methods inherited from class java.lang.Object |
|
Field Detail |
private java.awt.Component m_focusComponent
private int[] m_aKeyStates
private int[] m_aNumKeystrokes
private static final int KEY_UP
private static final int KEY_DOWN
private static final int KEY_WAS_DOWN_NOT_READ
private static final int KEY_WAS_DOWN_READ
private int m_lastAlphanumericKey
Constructor Detail |
CKeyboard(java.awt.Component component)
component
- The component that where listeners are registered.Method Detail |
public boolean isKeyDown(int keyCode)
isKeyDown
in interface KeyboardDevice
keyCode
- The keycode of the key we want to query.public boolean wasKeyDown(int keyCode)
wasKeyDown
in interface KeyboardDevice
gameframe.input.KeyboardDevice
keyCode
- The keycode of the key we want to query.public int getKeyDownCount(int keyCode)
getKeyDownCount
in interface KeyboardDevice
keyCode
- The keycode of the key we want to query.public void keyPressed(java.awt.event.KeyEvent event)
keyPressed
in interface java.awt.event.KeyListener
public void keyReleased(java.awt.event.KeyEvent event)
keyReleased
in interface java.awt.event.KeyListener
public void keyTyped(java.awt.event.KeyEvent event)
keyTyped
in interface java.awt.event.KeyListener
public int getTypedAlphanumericKey()
getTypedAlphanumericKey
in interface KeyboardDevice
public void finalize()
finalize
in interface KeyboardDevice
finalize
in class java.lang.Object
|
GF4J 0.9.4 Beta | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |