Interface KeyboardRobot

All Known Implementing Classes:
KeyboardRobotImpl

public interface KeyboardRobot
  • Method Summary

    Modifier and Type
    Method
    Description
    Set<javafx.scene.input.KeyCode>
    Gets the keys that have been pressed and not yet released.
    void
    press(javafx.scene.input.KeyCode... keys)
    Presses the given keys, until explicitly released via release(KeyCode...).
    void
    pressNoWait(javafx.scene.input.KeyCode... keys)
    Presses the given keys, until explicitly released via release(KeyCode...).
    void
    release(javafx.scene.input.KeyCode... keys)
    Releases the given keys.
    void
    releaseNoWait(javafx.scene.input.KeyCode... keys)
    Releases the given keys.
  • Method Details

    • press

      void press(javafx.scene.input.KeyCode... keys)
      Presses the given keys, until explicitly released via release(KeyCode...). Once pressed, WaitForAsyncUtils.waitForFxEvents() is called.
      Parameters:
      keys - the key codes to press
    • pressNoWait

      void pressNoWait(javafx.scene.input.KeyCode... keys)
      Presses the given keys, until explicitly released via release(KeyCode...). WaitForAsyncUtils.waitForFxEvents() is not called.
      Parameters:
      keys - the key codes to press without waiting afterwards
    • getPressedKeys

      Set<javafx.scene.input.KeyCode> getPressedKeys()
      Gets the keys that have been pressed and not yet released.
      Returns:
      an (unmodifiable) containing the keys that have been pressed (but not yet) released.
    • release

      void release(javafx.scene.input.KeyCode... keys)
      Releases the given keys. Once released, WaitForAsyncUtils.waitForFxEvents() is called.

      Note: passing in an empty KeyCode[] will release all pressed keys.

      Parameters:
      keys - the key codes to release
    • releaseNoWait

      void releaseNoWait(javafx.scene.input.KeyCode... keys)
      Releases the given keys. WaitForAsyncUtils.waitForFxEvents() is not called.

      Note: passing in an empty KeyCode[] will release all pressed keys.

      Parameters:
      keys - the key codes to release without waiting afterwards