Module org.testfx

Interface MouseRobot

  • All Known Implementing Classes:
    MouseRobotImpl

    public interface MouseRobot
    • Method Summary

      Modifier and Type Method Description
      Set<javafx.scene.input.MouseButton> getPressedButtons()
      Gets the mouse buttons that have been pressed but not yet released.
      void move​(javafx.geometry.Point2D location)
      Moves the mouse to the given location.
      void moveNoWait​(javafx.geometry.Point2D location)
      Moves the mouse to the given location.
      void press​(javafx.scene.input.MouseButton... buttons)
      Presses the given mouse buttons, until explicitly released via release(MouseButton...).
      void pressNoWait​(javafx.scene.input.MouseButton... buttons)
      Presses the given mouse buttons, until explicitly released via release(MouseButton...).
      void release​(javafx.scene.input.MouseButton... buttons)
      Releases the given mouse buttons.
      void releaseNoWait​(javafx.scene.input.MouseButton... buttons)
      Releases the given mouse buttons.
      void scroll​(int wheelAmount)
      Scrolls the mouse wheel by the given amount.
      void scrollNoWait​(int wheelAmount)
      Scrolls the mouse wheel by the given amount.
    • Method Detail

      • press

        void press​(javafx.scene.input.MouseButton... buttons)
        Presses the given mouse buttons, until explicitly released via release(MouseButton...). Once pressed, calls WaitForAsyncUtils.waitForFxEvents().

        Note: passing in an empty MouseButton[] will call press(MouseButton.PRIMARY).

        Parameters:
        buttons - the mouse buttons to press
      • pressNoWait

        void pressNoWait​(javafx.scene.input.MouseButton... buttons)
        Presses the given mouse buttons, until explicitly released via release(MouseButton...). Once pressed, WaitForAsyncUtils.waitForFxEvents() is not called.

        Note: passing in an empty MouseButton[] will call press(MouseButton.PRIMARY).

        Parameters:
        buttons - the mouse buttons to press without waiting afterwards
      • getPressedButtons

        Set<javafx.scene.input.MouseButton> getPressedButtons()
        Gets the mouse buttons that have been pressed but not yet released.
        Returns:
        an (unmodifiable) set containing the pressed (but not yet released) buttons
      • release

        void release​(javafx.scene.input.MouseButton... buttons)
        Releases the given mouse buttons. Once pressed, calls WaitForAsyncUtils.waitForFxEvents().

        Note: passing in an empty MouseButton[] will release all pressed MouseButtons.

        Parameters:
        buttons - the mouse buttons to release
      • releaseNoWait

        void releaseNoWait​(javafx.scene.input.MouseButton... buttons)
        Releases the given mouse buttons. Once pressed, WaitForAsyncUtils.waitForFxEvents() is not called.

        Note: passing in an empty MouseButton[] will release all pressed MouseButtons.

        Parameters:
        buttons - the mouse buttons to release without waiting afterwards
      • move

        void move​(javafx.geometry.Point2D location)
        Moves the mouse to the given location. Once moved, calls WaitForAsyncUtils.waitForFxEvents().
        Parameters:
        location - the location to move the mouse to
      • moveNoWait

        void moveNoWait​(javafx.geometry.Point2D location)
        Moves the mouse to the given location. Once moved, WaitForAsyncUtils.waitForFxEvents() is not called.
        Parameters:
        location - the location to move the mouse to without waiting afterwards
      • scroll

        void scroll​(int wheelAmount)
        Scrolls the mouse wheel by the given amount. Once scrolled, calls WaitForAsyncUtils.waitForFxEvents().
        Parameters:
        wheelAmount - the amount to scroll the mouse by
      • scrollNoWait

        void scrollNoWait​(int wheelAmount)
        Scrolls the mouse wheel by the given amount. Once scrolled, WaitForAsyncUtils.waitForFxEvents() is not called.
        Parameters:
        wheelAmount - the amount to scroll the mouse by without waiting afterwards