Class Keyboard

java.lang.Object
dev.kyzel.utils.Keyboard

public class Keyboard extends Object
A class to handle keyboard input.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    The class that holds properties of a key.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Constant to represent the A key.
    static final int
    Constant to represent the B key.
    static final int
    Constant to represent the C key.
    static final int
    Constant to represent the D key.
    static final int
    Constant to represent the E key.
    static final int
    Constant to represent the Escape key.
    static final int
    Constant to represent the F key.
    static final int
    Constant to represent the G key.
    static final int
    Constant to represent the H key.
    static final int
    Constant to represent the I key.
    static final int
    Constant to represent the J key.
    static final int
    Constant to represent the K key.
    static final int
    Constant to represent the L key.
    static final int
    Constant to represent the M key.
    static final int
    Constant to represent the N key.
    static final int
    Constant to represent the O key.
    static final int
    Constant to represent the P key.
    static final int
    Constant to represent the Q key.
    static final int
    Constant to represent the R key.
    static final int
    Constant to represent the S key.
    static final int
    Constant to represent the Space key.
    static final int
    Constant to represent the T key.
    static final int
    Constant to represent the U key.
    static final int
    Constant to represent the V key.
    static final int
    Constant to represent the W key.
    static final int
    Constant to represent the X key.
    static final int
    Constant to represent the Y key.
    static final int
    Constant to represent the Z key.
    static final Keyboard.Key[]
    A list of 128 keys.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the KeyListener of this Keyboard class.
    static void
    Updates the states of each key.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • KEY_ESCAPE

      public static final int KEY_ESCAPE
      Constant to represent the Escape key.
      See Also:
    • KEY_SPACE

      public static final int KEY_SPACE
      Constant to represent the Space key.
      See Also:
    • KEY_A

      public static final int KEY_A
      Constant to represent the A key.
      See Also:
    • KEY_B

      public static final int KEY_B
      Constant to represent the B key.
      See Also:
    • KEY_C

      public static final int KEY_C
      Constant to represent the C key.
      See Also:
    • KEY_D

      public static final int KEY_D
      Constant to represent the D key.
      See Also:
    • KEY_E

      public static final int KEY_E
      Constant to represent the E key.
      See Also:
    • KEY_F

      public static final int KEY_F
      Constant to represent the F key.
      See Also:
    • KEY_G

      public static final int KEY_G
      Constant to represent the G key.
      See Also:
    • KEY_H

      public static final int KEY_H
      Constant to represent the H key.
      See Also:
    • KEY_I

      public static final int KEY_I
      Constant to represent the I key.
      See Also:
    • KEY_J

      public static final int KEY_J
      Constant to represent the J key.
      See Also:
    • KEY_K

      public static final int KEY_K
      Constant to represent the K key.
      See Also:
    • KEY_L

      public static final int KEY_L
      Constant to represent the L key.
      See Also:
    • KEY_M

      public static final int KEY_M
      Constant to represent the M key.
      See Also:
    • KEY_N

      public static final int KEY_N
      Constant to represent the N key.
      See Also:
    • KEY_O

      public static final int KEY_O
      Constant to represent the O key.
      See Also:
    • KEY_P

      public static final int KEY_P
      Constant to represent the P key.
      See Also:
    • KEY_Q

      public static final int KEY_Q
      Constant to represent the Q key.
      See Also:
    • KEY_R

      public static final int KEY_R
      Constant to represent the R key.
      See Also:
    • KEY_S

      public static final int KEY_S
      Constant to represent the S key.
      See Also:
    • KEY_T

      public static final int KEY_T
      Constant to represent the T key.
      See Also:
    • KEY_U

      public static final int KEY_U
      Constant to represent the U key.
      See Also:
    • KEY_V

      public static final int KEY_V
      Constant to represent the V key.
      See Also:
    • KEY_W

      public static final int KEY_W
      Constant to represent the W key.
      See Also:
    • KEY_X

      public static final int KEY_X
      Constant to represent the X key.
      See Also:
    • KEY_Y

      public static final int KEY_Y
      Constant to represent the Y key.
      See Also:
    • KEY_Z

      public static final int KEY_Z
      Constant to represent the Z key.
      See Also:
    • keys

      public static final Keyboard.Key[] keys
      A list of 128 keys. Would not be a magic number, but it works.
  • Constructor Details

    • Keyboard

      public Keyboard()
  • Method Details

    • getListener

      public static KeyListener getListener()
      Gets the KeyListener of this Keyboard class.
      Returns:
      the key listener
    • update

      public static void update()
      Updates the states of each key.