Class Keyboard


  • public class Keyboard
    extends java.lang.Object
    Keeps track of the typed keys.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.List<java.lang.Object[]> keys_  
      private boolean startAtEnd_  
    • Constructor Summary

      Constructors 
      Constructor Description
      Keyboard()
      Creates a new instance.
      Keyboard​(boolean startAtEnd)
      Creates a new instance, specifying whether typing should start at the text end or not.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      Clears all keys.
      (package private) java.util.List<java.lang.Object[]> getKeys()
      Returns the keys.
      boolean isStartAtEnd()
      Returns whether typing should start at the text end or not.
      void press​(int keyCode)
      Press the specified key code (without releasing it).
      void release​(int keyCode)
      Releases the specified key code.
      void type​(char ch)
      Types the specified character.
      • Methods inherited from class java.lang.Object

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

      • keys_

        private final java.util.List<java.lang.Object[]> keys_
      • startAtEnd_

        private final boolean startAtEnd_
    • Constructor Detail

      • Keyboard

        public Keyboard()
        Creates a new instance.
      • Keyboard

        public Keyboard​(boolean startAtEnd)
        Creates a new instance, specifying whether typing should start at the text end or not.
        Parameters:
        startAtEnd - whether typing should start at the text end or not
    • Method Detail

      • type

        public void type​(char ch)
        Types the specified character.
        Parameters:
        ch - the character
      • press

        public void press​(int keyCode)
        Press the specified key code (without releasing it).

        An example of predefined values is KeyboardEvent.DOM_VK_PAGE_DOWN.

        Parameters:
        keyCode - the key code
      • release

        public void release​(int keyCode)
        Releases the specified key code.

        An example of predefined values is KeyboardEvent.DOM_VK_PAGE_DOWN.

        Parameters:
        keyCode - the key code.
      • clear

        public void clear()
        Clears all keys.
      • getKeys

        java.util.List<java.lang.Object[]> getKeys()
        Returns the keys.

        If the length of the item is 1, then it is a character. If the length of the item is 2, the first is the key code, the second is boolean whether pressing or not

        Returns:
        the keys
      • isStartAtEnd

        public boolean isStartAtEnd()
        Returns whether typing should start at the text end or not.
        Returns:
        whether typing should start at the text end or not