Class AwtKeyInput

All Implemented Interfaces:
Input, KeyInput, KeyListener, EventListener

public class AwtKeyInput extends Object implements KeyInput, KeyListener
  • Constructor Details

    • AwtKeyInput

      public AwtKeyInput()
  • Method Details

    • 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(Component comp)
    • getInputTimeNanos

      public long getInputTimeNanos()
      Specified by:
      getInputTimeNanos in interface Input
      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:
    • isInitialized

      public boolean isInitialized()
      Specified by:
      isInitialized in interface Input
      True if the device has been initialized and not destroyed.
      See Also:
    • 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
      listener - the desired listener
    • keyTyped

      public void keyTyped(KeyEvent evt)
      Specified by:
      keyTyped in interface KeyListener
    • keyPressed

      public void keyPressed(KeyEvent evt)
      Specified by:
      keyPressed in interface KeyListener
    • keyReleased

      public void keyReleased(KeyEvent evt)
      Specified by:
      keyReleased in interface KeyListener
    • convertJmeCode

      public static int convertJmeCode(int key)
      convertJmeCode converts KeyInput key codes to AWT key codes.
      key - jme KeyInput key code
      awt KeyEvent key code
    • convertAwtKey

      public static int convertAwtKey(int key)
      convertAwtKey converts AWT key codes to KeyInput key codes.
      key - awt KeyEvent key code
      jme KeyInput key code
    • getKeyName

      public String getKeyName(int key)
      Description copied from interface: KeyInput
      Determine the name of the specified key in the current system language.
      Specified by:
      getKeyName in interface KeyInput
      key - The keycode from KeyInput
      the name of the key