Enum Class KeyCode

java.lang.Object
java.lang.Enum<KeyCode>
org.openpatch.scratch.KeyCode
All Implemented Interfaces:
Serializable, Comparable<KeyCode>, Constable

public enum KeyCode extends Enum<KeyCode>
Key codes for keyboard input handling.

Use these constants to check which key was pressed or released.

 
 // In whenKeyPressed:
 if (keyCode == KeyCode.SPACE) { ... }

 // In isKeyPressed:
 if (this.isKeyPressed(KeyCode.UP)) { ... }
 
 
  • Enum Constant Details

    • ENTER

      public static final KeyCode ENTER
    • BACKSPACE

      public static final KeyCode BACKSPACE
    • TAB

      public static final KeyCode TAB
    • CANCEL

      public static final KeyCode CANCEL
    • CLEAR

      public static final KeyCode CLEAR
    • SHIFT

      public static final KeyCode SHIFT
    • CTRL

      public static final KeyCode CTRL
    • ALT

      public static final KeyCode ALT
    • PAUSE

      public static final KeyCode PAUSE
    • CAPS_LOCK

      public static final KeyCode CAPS_LOCK
    • ESCAPE

      public static final KeyCode ESCAPE
    • SPACE

      public static final KeyCode SPACE
    • PAGE_UP

      public static final KeyCode PAGE_UP
    • PAGE_DOWN

      public static final KeyCode PAGE_DOWN
    • END

      public static final KeyCode END
    • HOME

      public static final KeyCode HOME
    • LEFT

      public static final KeyCode LEFT
    • UP

      public static final KeyCode UP
    • DOWN

      public static final KeyCode DOWN
    • COMMA

      public static final KeyCode COMMA
    • MINUS

      public static final KeyCode MINUS
    • PERIOD

      public static final KeyCode PERIOD
    • SLASH

      public static final KeyCode SLASH
    • DIGIT_0

      public static final KeyCode DIGIT_0
    • DIGIT_1

      public static final KeyCode DIGIT_1
    • DIGIT_2

      public static final KeyCode DIGIT_2
    • DIGIT_3

      public static final KeyCode DIGIT_3
    • DIGIT_4

      public static final KeyCode DIGIT_4
    • DIGIT_5

      public static final KeyCode DIGIT_5
    • DIGIT_6

      public static final KeyCode DIGIT_6
    • DIGIT_7

      public static final KeyCode DIGIT_7
    • DIGIT_8

      public static final KeyCode DIGIT_8
    • DIGIT_9

      public static final KeyCode DIGIT_9
    • SEMICOLON

      public static final KeyCode SEMICOLON
    • EQUALS

      public static final KeyCode EQUALS
    • A

      public static final KeyCode A
    • B

      public static final KeyCode B
    • C

      public static final KeyCode C
    • D

      public static final KeyCode D
    • E

      public static final KeyCode E
    • F

      public static final KeyCode F
    • G

      public static final KeyCode G
    • H

      public static final KeyCode H
    • I

      public static final KeyCode I
    • J

      public static final KeyCode J
    • K

      public static final KeyCode K
    • L

      public static final KeyCode L
    • M

      public static final KeyCode M
    • N

      public static final KeyCode N
    • O

      public static final KeyCode O
    • P

      public static final KeyCode P
    • Q

      public static final KeyCode Q
    • R

      public static final KeyCode R
    • S

      public static final KeyCode S
    • T

      public static final KeyCode T
    • U

      public static final KeyCode U
    • V

      public static final KeyCode V
    • W

      public static final KeyCode W
    • X

      public static final KeyCode X
    • Y

      public static final KeyCode Y
    • Z

      public static final KeyCode Z
    • OPEN_BRACKET

      public static final KeyCode OPEN_BRACKET
    • BACK_SLASH

      public static final KeyCode BACK_SLASH
    • CLOSE_BRACKET

      public static final KeyCode CLOSE_BRACKET
    • NUMPAD_0

      public static final KeyCode NUMPAD_0
    • NUMPAD_1

      public static final KeyCode NUMPAD_1
    • NUMPAD_2

      public static final KeyCode NUMPAD_2
    • NUMPAD_3

      public static final KeyCode NUMPAD_3
    • NUMPAD_4

      public static final KeyCode NUMPAD_4
    • NUMPAD_5

      public static final KeyCode NUMPAD_5
    • NUMPAD_6

      public static final KeyCode NUMPAD_6
    • NUMPAD_7

      public static final KeyCode NUMPAD_7
    • NUMPAD_8

      public static final KeyCode NUMPAD_8
    • NUMPAD_9

      public static final KeyCode NUMPAD_9
    • MULTIPLY

      public static final KeyCode MULTIPLY
    • ADD

      public static final KeyCode ADD
    • SUBTRACT

      public static final KeyCode SUBTRACT
    • DECIMAL

      public static final KeyCode DECIMAL
    • DIVIDE

      public static final KeyCode DIVIDE
    • F1

      public static final KeyCode F1
    • F2

      public static final KeyCode F2
    • F3

      public static final KeyCode F3
    • F4

      public static final KeyCode F4
    • F5

      public static final KeyCode F5
    • F6

      public static final KeyCode F6
    • F7

      public static final KeyCode F7
    • F8

      public static final KeyCode F8
    • F9

      public static final KeyCode F9
    • F10

      public static final KeyCode F10
    • F11

      public static final KeyCode F11
    • F12

      public static final KeyCode F12
    • DELETE

      public static final KeyCode DELETE
    • NUM_LOCK

      public static final KeyCode NUM_LOCK
    • SCROLL_LOCK

      public static final KeyCode SCROLL_LOCK
    • INSERT

      public static final KeyCode INSERT
    • HELP

      public static final KeyCode HELP
    • META

      public static final KeyCode META
    • BACK_QUOTE

      public static final KeyCode BACK_QUOTE
    • QUOTE

      public static final KeyCode QUOTE
    • KP_UP

      public static final KeyCode KP_UP
    • KP_DOWN

      public static final KeyCode KP_DOWN
    • KP_LEFT

      public static final KeyCode KP_LEFT
    • KP_RIGHT

      public static final KeyCode KP_RIGHT
    • WINDOWS

      public static final KeyCode WINDOWS
    • CONTEXT_MENU

      public static final KeyCode CONTEXT_MENU
    • UNKNOWN

      public static final KeyCode UNKNOWN
  • Method Details

    • values

      public static KeyCode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static KeyCode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getCode

      public int getCode()
    • fromCode

      public static KeyCode fromCode(int code)