Enum Key

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<Key>

    public enum Key
    extends java.lang.Enum<Key>
    Enum representing the possible keys to press Alphabet will automatically adjust to upper/lowercase based on whether shift is currently being held if you use getChar()
    • Enum Constant Detail

      • A

        public static final Key A
      • B

        public static final Key B
      • C

        public static final Key C
      • D

        public static final Key D
      • E

        public static final Key E
      • F

        public static final Key F
      • G

        public static final Key G
      • H

        public static final Key H
      • I

        public static final Key I
      • J

        public static final Key J
      • K

        public static final Key K
      • L

        public static final Key L
      • M

        public static final Key M
      • N

        public static final Key N
      • O

        public static final Key O
      • P

        public static final Key P
      • Q

        public static final Key Q
      • R

        public static final Key R
      • S

        public static final Key S
      • T

        public static final Key T
      • U

        public static final Key U
      • V

        public static final Key V
      • W

        public static final Key W
      • X

        public static final Key X
      • Y

        public static final Key Y
      • Z

        public static final Key Z
      • ONE

        public static final Key ONE
      • TWO

        public static final Key TWO
      • THREE

        public static final Key THREE
      • FOUR

        public static final Key FOUR
      • FIVE

        public static final Key FIVE
      • SIX

        public static final Key SIX
      • SEVEN

        public static final Key SEVEN
      • EIGHT

        public static final Key EIGHT
      • NINE

        public static final Key NINE
      • ZERO

        public static final Key ZERO
      • ESC

        public static final Key ESC
      • TAB

        public static final Key TAB
      • CAPS

        public static final Key CAPS
      • WINDOWS

        public static final Key WINDOWS
      • CTRL

        public static final Key CTRL
      • ALT

        public static final Key ALT
      • SHIFT

        public static final Key SHIFT
      • SPACE

        public static final Key SPACE
      • BACKSPACE

        public static final Key BACKSPACE
      • ENTER

        public static final Key ENTER
      • DELETE

        public static final Key DELETE
      • MINUS

        public static final Key MINUS
      • EQUALS

        public static final Key EQUALS
      • BACK_QUOTE

        public static final Key BACK_QUOTE
      • OPEN_BRACKET

        public static final Key OPEN_BRACKET
      • CLOSE_BRACKET

        public static final Key CLOSE_BRACKET
      • BACK_SLASH

        public static final Key BACK_SLASH
      • COMMA

        public static final Key COMMA
      • PERIOD

        public static final Key PERIOD
      • FORWARD_SLASH

        public static final Key FORWARD_SLASH
      • SEMICOLON

        public static final Key SEMICOLON
      • SINGLE_QUOTE

        public static final Key SINGLE_QUOTE
      • LEFT

        public static final Key LEFT
      • UP

        public static final Key UP
      • RIGHT

        public static final Key RIGHT
      • DOWN

        public static final Key DOWN
      • F1

        public static final Key F1
      • F2

        public static final Key F2
      • F3

        public static final Key F3
      • F4

        public static final Key F4
      • F5

        public static final Key F5
      • F6

        public static final Key F6
      • F7

        public static final Key F7
      • F8

        public static final Key F8
      • F9

        public static final Key F9
      • F10

        public static final Key F10
      • F11

        public static final Key F11
      • F12

        public static final Key F12
      • TILDE

        public static final Key TILDE
      • EXCLAMATION

        public static final Key EXCLAMATION
      • AT

        public static final Key AT
      • POUND

        public static final Key POUND
      • DOLLAR

        public static final Key DOLLAR
      • PERCENT

        public static final Key PERCENT
      • CARET

        public static final Key CARET
      • AND

        public static final Key AND
      • ASTERISK

        public static final Key ASTERISK
      • LEFT_PAREN

        public static final Key LEFT_PAREN
      • RIGHT_PAREN

        public static final Key RIGHT_PAREN
      • UNDERSCORE

        public static final Key UNDERSCORE
      • PLUS

        public static final Key PLUS
      • OPEN_CURLY_BRACKET

        public static final Key OPEN_CURLY_BRACKET
      • CLOSE_CURLY_BRACKET

        public static final Key CLOSE_CURLY_BRACKET
      • PIPE

        public static final Key PIPE
      • LESS_THAN

        public static final Key LESS_THAN
      • GREATER_THAN

        public static final Key GREATER_THAN
      • QUESTION_MARK

        public static final Key QUESTION_MARK
      • COLON

        public static final Key COLON
      • DOUBLE_QUOTES

        public static final Key DOUBLE_QUOTES
    • Method Detail

      • values

        public static Key[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (Key c : Key.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Key valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • requiresTyped

        public boolean requiresTyped()
      • isPressed

        public boolean isPressed()
      • markReleased

        public void markReleased()
      • markPressed

        public void markPressed()
      • setLastPressedLocation

        public void setLastPressedLocation​(KeyLocation location)
      • getChar

        public char getChar()
        If key char is a letter, it will automatically adjust to upper/lowercase based on if the shift key is held
        Returns:
        char representation of getKeyChar()
      • getForCode

        public static Key getForCode​(int code)
        Gets a Key based on the given key code Note: keys that require shift like EXCLAMATION share the same key code as their non-shift counterparts Either use the key enum directly or use getForChar(char) If you get the error for key not found, please report to one of the client developers which key you're trying to use so it may be added
        Parameters:
        code - KeyCode to look for
        Returns:
        Key for that key code if found, otherwise null
      • getForChar

        public static Key getForChar​(char character)
        Gets a Key based on the given character Note: not all keys have a character like CAPS please use getForCode(int) or use the Key directly Automatically adjusts alphabetical characters to be uppercase to match the key's default char value If the error is logged for failing to find the key for your character, please report to a client developer what character you're trying to use.
        Parameters:
        character - char value to match against a Key
        Returns:
        Key for the character given, otherwise null if not found
      • getKeyCode

        public int getKeyCode()
      • getKeyChar

        public int getKeyChar()
      • getDefaultModifiers

        public int getDefaultModifiers()
      • getDefaultLocation

        public KeyLocation getDefaultLocation()
      • getRawCode

        public int getRawCode()
      • getPrimaryLevelUnicode

        public int getPrimaryLevelUnicode()
      • getExtendedKeyCode

        public int getExtendedKeyCode()
      • getScanCode

        public int getScanCode()
      • getLastPressedLocation

        public KeyLocation getLastPressedLocation()