com.jme3.input.awt
Class AwtKeyInput

java.lang.Object
  extended by com.jme3.input.awt.AwtKeyInput
All Implemented Interfaces:
Input, KeyInput, java.awt.event.KeyListener, java.util.EventListener

public class AwtKeyInput
extends java.lang.Object
implements KeyInput, java.awt.event.KeyListener

AwtKeyInput


Field Summary
 
Fields inherited from interface com.jme3.input.KeyInput
KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9, KEY_A, KEY_ADD, KEY_APOSTROPHE, KEY_APPS, KEY_AT, KEY_AX, KEY_B, KEY_BACK, KEY_BACKSLASH, KEY_C, KEY_CAPITAL, KEY_CIRCUMFLEX, KEY_COLON, KEY_COMMA, KEY_CONVERT, KEY_D, KEY_DECIMAL, KEY_DELETE, KEY_DIVIDE, KEY_DOWN, KEY_E, KEY_END, KEY_EQUALS, KEY_ESCAPE, KEY_F, KEY_F1, KEY_F10, KEY_F11, KEY_F12, KEY_F13, KEY_F14, KEY_F15, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6, KEY_F7, KEY_F8, KEY_F9, KEY_G, KEY_GRAVE, KEY_H, KEY_HOME, KEY_I, KEY_INSERT, KEY_J, KEY_K, KEY_KANA, KEY_KANJI, KEY_L, KEY_LBRACKET, KEY_LCONTROL, KEY_LEFT, KEY_LMENU, KEY_LMETA, KEY_LSHIFT, KEY_M, KEY_MINUS, KEY_MULTIPLY, KEY_N, KEY_NEXT, KEY_NOCONVERT, KEY_NUMLOCK, KEY_NUMPAD0, KEY_NUMPAD1, KEY_NUMPAD2, KEY_NUMPAD3, KEY_NUMPAD4, KEY_NUMPAD5, KEY_NUMPAD6, KEY_NUMPAD7, KEY_NUMPAD8, KEY_NUMPAD9, KEY_NUMPADCOMMA, KEY_NUMPADENTER, KEY_NUMPADEQUALS, KEY_O, KEY_P, KEY_PAUSE, KEY_PERIOD, KEY_PGDN, KEY_PGUP, KEY_POWER, KEY_PRIOR, KEY_Q, KEY_R, KEY_RBRACKET, KEY_RCONTROL, KEY_RETURN, KEY_RIGHT, KEY_RMENU, KEY_RMETA, KEY_RSHIFT, KEY_S, KEY_SCROLL, KEY_SEMICOLON, KEY_SLASH, KEY_SLEEP, KEY_SPACE, KEY_STOP, KEY_SUBTRACT, KEY_SYSRQ, KEY_T, KEY_TAB, KEY_U, KEY_UNDERLINE, KEY_UNLABELED, KEY_UP, KEY_V, KEY_W, KEY_X, KEY_Y, KEY_YEN, KEY_Z
 
Constructor Summary
AwtKeyInput()
           
 
Method Summary
static int convertAwtKey(int key)
          convertAwtKey converts AWT key codes to KeyInput key codes.
static int convertJmeCode(int key)
          convertJmeCode converts KeyInput key codes to AWT key codes.
 void destroy()
          Ceases listening to events from the device.
 long getInputTimeNanos()
           
 int getKeyCount()
           
 void initialize()
          Initializes the native side to listen into events from the device.
 boolean isInitialized()
           
 void keyPressed(java.awt.event.KeyEvent evt)
           
 void keyReleased(java.awt.event.KeyEvent evt)
           
 void keyTyped(java.awt.event.KeyEvent evt)
           
 void setInputListener(RawInputListener listener)
          Sets the input listener to receive events from this device.
 void setInputSource(java.awt.Component comp)
           
 void update()
          Queries the device for input.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AwtKeyInput

public AwtKeyInput()
Method Detail

initialize

public void initialize()
Description copied from interface: Input
Initializes the native side to listen into events from the device.

Specified by:
initialize in interface Input

destroy

public void destroy()
Description copied from interface: Input
Ceases listening to events from the device.

Specified by:
destroy in interface Input

setInputSource

public void setInputSource(java.awt.Component comp)

getInputTimeNanos

public long getInputTimeNanos()
Specified by:
getInputTimeNanos in interface Input
Returns:
The current absolute time as nanoseconds. This time is expected to be relative to the time given in InputEvents time property.

getKeyCount

public int getKeyCount()

update

public void update()
Description copied from interface: Input
Queries the device for input. All events should be sent to the RawInputListener set with setInputListener.

Specified by:
update in interface Input
See Also:
Input.setInputListener(com.jme3.input.RawInputListener)

isInitialized

public boolean isInitialized()
Specified by:
isInitialized in interface Input
Returns:
True if the device has been initialized and not destroyed.
See Also:
Input.initialize(), Input.destroy()

setInputListener

public void setInputListener(RawInputListener listener)
Description copied from interface: Input
Sets the input listener to receive events from this device. The appropriate events should be dispatched through the callbacks in RawInputListener.

Specified by:
setInputListener in interface Input

keyTyped

public void keyTyped(java.awt.event.KeyEvent evt)
Specified by:
keyTyped in interface java.awt.event.KeyListener

keyPressed

public void keyPressed(java.awt.event.KeyEvent evt)
Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent evt)
Specified by:
keyReleased in interface java.awt.event.KeyListener

convertJmeCode

public static int convertJmeCode(int key)
convertJmeCode converts KeyInput key codes to AWT key codes.

Parameters:
key - jme KeyInput key code
Returns:
awt KeyEvent key code

convertAwtKey

public static int convertAwtKey(int key)
convertAwtKey converts AWT key codes to KeyInput key codes.

Parameters:
key - awt KeyEvent key code
Returns:
jme KeyInput key code