java.lang.Object
nl.colorize.multimedialib.renderer.java2d.AWTInput
All Implemented Interfaces:
KeyListener, MouseListener, MouseMotionListener, EventListener, InputDevice, Updatable

public class AWTInput extends Object implements InputDevice, KeyListener, MouseListener, MouseMotionListener
Input device that uses AWT to capture mouse and keyboard events.
  • Constructor Details

    • AWTInput

      public AWTInput(Canvas canvas)
  • Method Details

    • update

      public void update(float deltaTime)
      Copies all events that have been received during the last frame to this class' internal state. This method must be called every frame.
      Specified by:
      update in interface Updatable
    • keyPressed

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

      public void keyReleased(KeyEvent e)
      Specified by:
      keyReleased in interface KeyListener
    • keyTyped

      public void keyTyped(KeyEvent e)
      Specified by:
      keyTyped in interface KeyListener
    • mousePressed

      public void mousePressed(MouseEvent e)
      Specified by:
      mousePressed in interface MouseListener
    • mouseReleased

      public void mouseReleased(MouseEvent e)
      Specified by:
      mouseReleased in interface MouseListener
    • mouseClicked

      public void mouseClicked(MouseEvent e)
      Specified by:
      mouseClicked in interface MouseListener
    • mouseEntered

      public void mouseEntered(MouseEvent e)
      Specified by:
      mouseEntered in interface MouseListener
    • mouseExited

      public void mouseExited(MouseEvent e)
      Specified by:
      mouseExited in interface MouseListener
    • mouseMoved

      public void mouseMoved(MouseEvent e)
      Specified by:
      mouseMoved in interface MouseMotionListener
    • mouseDragged

      public void mouseDragged(MouseEvent e)
      Specified by:
      mouseDragged in interface MouseMotionListener
    • getPointers

      public Iterable<Pointer> getPointers()
      Description copied from interface: InputDevice
      Returns all currently active pointers. Depending on the current platform and device, pointers could be based on mouse input, a trackpad, or touch controls.

      Note that the type of pointer will also influence its behavior. The mouse pointer is always included in this list, since the mouse cursor is always visible. Touch pointer are only available during the touch, as the pointer disappears once the touch event has ended.

      Specified by:
      getPointers in interface InputDevice
    • clearPointerState

      public void clearPointerState()
      Description copied from interface: InputDevice
      Clears all pointer state for all currently active pointers.
      Specified by:
      clearPointerState in interface InputDevice
    • isTouchAvailable

      public boolean isTouchAvailable()
      Specified by:
      isTouchAvailable in interface InputDevice
    • isKeyboardAvailable

      public boolean isKeyboardAvailable()
      Specified by:
      isKeyboardAvailable in interface InputDevice
    • isKeyPressed

      public boolean isKeyPressed(KeyCode keyCode)
      Description copied from interface: InputDevice
      Returns true if the key with the specified key code was pressed during the current frame.
      Specified by:
      isKeyPressed in interface InputDevice
    • isKeyPressed

      public boolean isKeyPressed(int keycode)
    • isKeyReleased

      public boolean isKeyReleased(KeyCode keyCode)
      Description copied from interface: InputDevice
      Returns true if the key with the specified key code was released during the current frame.
      Specified by:
      isKeyReleased in interface InputDevice
    • isKeyReleased

      public boolean isKeyReleased(int keycode)
    • requestTextInput

      public String requestTextInput(String labelText, String initialValue)
      Description copied from interface: InputDevice
      Shows a dialog window requesting the user to enter text. This method exists only because text fields, unlike other input elements such as buttons, cannot be emulated by the renderer without losing common functionality such as copy/paste. Text input must therefore be delegated to the platform so that a native text field can be used.
      Specified by:
      requestTextInput in interface InputDevice
    • fillClipboard

      public void fillClipboard(String text)
      Description copied from interface: InputDevice
      Copies the specified text to the system clipboard.
      Specified by:
      fillClipboard in interface InputDevice