Class Keys

java.lang.Object
nz.ac.vuw.ecs.swen225.gp22.app.Keys
All Implemented Interfaces:
KeyListener, EventListener
Direct Known Subclasses:
Controller

public class Keys extends Object implements KeyListener
To map key events to actions.
Author:
Molly Henry
  • Constructor Details

    • Keys

      public Keys()
  • Method Details

    • setAction

      public void setAction(int keyCode, Runnable onReleased, boolean ctrlDown)
      Set keys for actions that happen on release
      Parameters:
      keyCode - keycode to set
      onReleased - action on release
      ctrlDown - should ctrl be pressed
    • setAction

      public void setAction(int keyCode, Runnable onPressed)
      Set keys for actions that happen on press
      Parameters:
      keyCode - keycode to set
      onPressed - action on press
    • keyTyped

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

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

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