- java.lang.Object
-
- org.testfx.robot.impl.MouseRobotImpl
-
- All Implemented Interfaces:
MouseRobot
public class MouseRobotImpl extends Object implements MouseRobot
-
-
Constructor Summary
Constructors Constructor Description MouseRobotImpl(BaseRobot baseRobot)
-
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 viaMouseRobot.release(MouseButton...)
.void
pressNoWait(javafx.scene.input.MouseButton... buttons)
Presses the given mouse buttons, until explicitly released viaMouseRobot.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.
-
-
-
Constructor Detail
-
MouseRobotImpl
public MouseRobotImpl(BaseRobot baseRobot)
-
-
Method Detail
-
press
public void press(javafx.scene.input.MouseButton... buttons)
Description copied from interface:MouseRobot
Presses the given mouse buttons, until explicitly released viaMouseRobot.release(MouseButton...)
. Once pressed, callsWaitForAsyncUtils.waitForFxEvents()
.Note: passing in an empty
MouseButton[]
will callpress(MouseButton.PRIMARY)
.- Specified by:
press
in interfaceMouseRobot
- Parameters:
buttons
- the mouse buttons to press
-
pressNoWait
public void pressNoWait(javafx.scene.input.MouseButton... buttons)
Description copied from interface:MouseRobot
Presses the given mouse buttons, until explicitly released viaMouseRobot.release(MouseButton...)
. Once pressed,WaitForAsyncUtils.waitForFxEvents()
is not called.Note: passing in an empty
MouseButton[]
will callpress(MouseButton.PRIMARY)
.- Specified by:
pressNoWait
in interfaceMouseRobot
- Parameters:
buttons
- the mouse buttons to press without waiting afterwards
-
release
public void release(javafx.scene.input.MouseButton... buttons)
Description copied from interface:MouseRobot
Releases the given mouse buttons. Once pressed, callsWaitForAsyncUtils.waitForFxEvents()
.Note: passing in an empty
MouseButton[]
will release all pressedMouseButton
s.- Specified by:
release
in interfaceMouseRobot
- Parameters:
buttons
- the mouse buttons to release
-
releaseNoWait
public void releaseNoWait(javafx.scene.input.MouseButton... buttons)
Description copied from interface:MouseRobot
Releases the given mouse buttons. Once pressed,WaitForAsyncUtils.waitForFxEvents()
is not called.Note: passing in an empty
MouseButton[]
will release all pressedMouseButton
s.- Specified by:
releaseNoWait
in interfaceMouseRobot
- Parameters:
buttons
- the mouse buttons to release without waiting afterwards
-
move
public void move(javafx.geometry.Point2D location)
Description copied from interface:MouseRobot
Moves the mouse to the given location. Once moved, callsWaitForAsyncUtils.waitForFxEvents()
.- Specified by:
move
in interfaceMouseRobot
- Parameters:
location
- the location to move the mouse to
-
moveNoWait
public void moveNoWait(javafx.geometry.Point2D location)
Description copied from interface:MouseRobot
Moves the mouse to the given location. Once moved,WaitForAsyncUtils.waitForFxEvents()
is not called.- Specified by:
moveNoWait
in interfaceMouseRobot
- Parameters:
location
- the location to move the mouse to without waiting afterwards
-
scroll
public void scroll(int wheelAmount)
Description copied from interface:MouseRobot
Scrolls the mouse wheel by the given amount. Once scrolled, callsWaitForAsyncUtils.waitForFxEvents()
.- Specified by:
scroll
in interfaceMouseRobot
- Parameters:
wheelAmount
- the amount to scroll the mouse by
-
scrollNoWait
public void scrollNoWait(int wheelAmount)
Description copied from interface:MouseRobot
Scrolls the mouse wheel by the given amount. Once scrolled,WaitForAsyncUtils.waitForFxEvents()
is not called.- Specified by:
scrollNoWait
in interfaceMouseRobot
- Parameters:
wheelAmount
- the amount to scroll the mouse by without waiting afterwards
-
getPressedButtons
public final Set<javafx.scene.input.MouseButton> getPressedButtons()
Description copied from interface:MouseRobot
Gets the mouse buttons that have been pressed but not yet released.- Specified by:
getPressedButtons
in interfaceMouseRobot
- Returns:
- an (unmodifiable) set containing the pressed (but not yet released) buttons
-
-