Class KeyPressEventArgs

java.lang.Object
codedraw.events.KeyPressEventArgs

public class KeyPressEventArgs extends Object
This argument is given continuously while a key is being held down.
  • Constructor Details

    • KeyPressEventArgs

      public KeyPressEventArgs(KeyEvent e)
  • Method Details

    • getKey

      public Key getKey()
      Gets the key that was pressed to trigger the event. If the key is not found or unknown the key value Key.UNDEFINED will be used.
      Returns:
      a key.
    • getChar

      public char getChar()
      Gets the character representation of the key that was pressed. For example pressing the A key + SHIFT will result in an 'A', but without pressing SHIFT will result in a lowercase 'a'.
      Returns:
      a char.
    • getExtendedKeyCode

      public int getExtendedKeyCode()
      Returns the key code of the key pressed. The extended key code can be used to uniquely identify a key on a keyboard.
      Returns:
      the key code.
    • isControlDown

      public boolean isControlDown()
      Gets whether control was pressed.
      Returns:
      true if control was pressed, otherwise false.
    • isAltDown

      public boolean isAltDown()
      Gets whether alt was pressed.
      Returns:
      true if alt was pressed, otherwise false.
    • isAltGraphDown

      public boolean isAltGraphDown()
      Gets whether alt graph was pressed.
      Returns:
      true if alt graph was pressed, otherwise false.
    • isShiftDown

      public boolean isShiftDown()
      Gets whether shift was pressed.
      Returns:
      true if shift was pressed, otherwise false.