Class Keyboard

java.lang.Object
org.htmlunit.html.Keyboard

public class Keyboard extends Object
Keeps track of the typed keys.
  • Constructor Summary Link icon

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

    Modifier and Type
    Method
    Description
    void
    Clears all keys.
    boolean
    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 Link icon

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details Link icon

    • Keyboard Link icon

      public Keyboard()
      Creates a new instance.
    • Keyboard Link icon

      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 Details Link icon

    • type Link icon

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

      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 Link icon

      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 Link icon

      public void clear()
      Clears all keys.
    • isStartAtEnd Link icon

      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