Class Keyboard


  • public class Keyboard
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.ArrayList<java.lang.Integer> invalidatedKeys  
      private static java.util.ArrayList<java.lang.Integer> pressedKeyCodes  
    • Constructor Summary

      Constructors 
      Constructor Description
      Keyboard()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void invalidateKey​(int keyCode)
      "Invalidate" the given key, which means that it will need to be "re-pressed" in order to appear in pressedKeyCodes again
      static boolean isPressed​(int keyCode)
      Returns whether or not the specified key is currently being pressed down
      static void keyPressed​(int keyCode)  
      static void keyReleased​(int keyCode)  
      static java.util.ArrayList<java.lang.Integer> pressed()  
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • pressedKeyCodes

        private static final java.util.ArrayList<java.lang.Integer> pressedKeyCodes
      • invalidatedKeys

        private static final java.util.ArrayList<java.lang.Integer> invalidatedKeys
    • Constructor Detail

      • Keyboard

        public Keyboard()
    • Method Detail

      • invalidateKey

        public static void invalidateKey​(int keyCode)
        "Invalidate" the given key, which means that it will need to be "re-pressed" in order to appear in pressedKeyCodes again
        Parameters:
        keyCode - The key code of the key to invalidate
      • isPressed

        public static boolean isPressed​(int keyCode)
        Returns whether or not the specified key is currently being pressed down
        Parameters:
        keyCode - The key code from KeyEvent
        Returns:
        Whether or not the specified key is currently being pressed down
      • pressed

        public static java.util.ArrayList<java.lang.Integer> pressed()
      • keyPressed

        public static void keyPressed​(int keyCode)
      • keyReleased

        public static void keyReleased​(int keyCode)