Package org.testfx.robot.impl
Class MouseRobotImpl
- java.lang.Object
-
- org.testfx.robot.impl.MouseRobotImpl
-
- All Implemented Interfaces:
MouseRobot
public class MouseRobotImpl extends java.lang.Object implements MouseRobot
-
-
Field Summary
Fields Modifier and Type Field Description private BaseRobotbaseRobotprivate java.util.Set<javafx.scene.input.MouseButton>pressedButtons
-
Constructor Summary
Constructors Constructor Description MouseRobotImpl(BaseRobot baseRobot)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set<javafx.scene.input.MouseButton>getPressedButtons()Gets the mouse buttons that have been pressed but not yet released.voidmove(javafx.geometry.Point2D location)Moves the mouse to the given location.voidmoveNoWait(javafx.geometry.Point2D location)Moves the mouse to the given location.voidpress(javafx.scene.input.MouseButton... buttons)Presses the given mouse buttons, until explicitly released viaMouseRobot.release(MouseButton...).private voidpressButton(javafx.scene.input.MouseButton button)voidpressNoWait(javafx.scene.input.MouseButton... buttons)Presses the given mouse buttons, until explicitly released viaMouseRobot.release(MouseButton...).voidrelease(javafx.scene.input.MouseButton... buttons)Releases the given mouse buttons.private voidreleaseButton(javafx.scene.input.MouseButton button)voidreleaseNoWait(javafx.scene.input.MouseButton... buttons)Releases the given mouse buttons.voidscroll(int wheelAmount)Scrolls the mouse wheel by the given amount.voidscrollNoWait(int wheelAmount)Scrolls the mouse wheel by the given amount.
-
-
-
Field Detail
-
baseRobot
private final BaseRobot baseRobot
-
pressedButtons
private final java.util.Set<javafx.scene.input.MouseButton> pressedButtons
-
-
Constructor Detail
-
MouseRobotImpl
public MouseRobotImpl(BaseRobot baseRobot)
-
-
Method Detail
-
press
public void press(javafx.scene.input.MouseButton... buttons)
Description copied from interface:MouseRobotPresses 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:
pressin interfaceMouseRobot- Parameters:
buttons- the mouse buttons to press
-
pressNoWait
public void pressNoWait(javafx.scene.input.MouseButton... buttons)
Description copied from interface:MouseRobotPresses 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:
pressNoWaitin interfaceMouseRobot- Parameters:
buttons- the mouse buttons to press without waiting afterwards
-
release
public void release(javafx.scene.input.MouseButton... buttons)
Description copied from interface:MouseRobotReleases the given mouse buttons. Once pressed, callsWaitForAsyncUtils.waitForFxEvents().Note: passing in an empty
MouseButton[]will release all pressedMouseButtons.- Specified by:
releasein interfaceMouseRobot- Parameters:
buttons- the mouse buttons to release
-
releaseNoWait
public void releaseNoWait(javafx.scene.input.MouseButton... buttons)
Description copied from interface:MouseRobotReleases the given mouse buttons. Once pressed,WaitForAsyncUtils.waitForFxEvents()is not called.Note: passing in an empty
MouseButton[]will release all pressedMouseButtons.- Specified by:
releaseNoWaitin interfaceMouseRobot- Parameters:
buttons- the mouse buttons to release without waiting afterwards
-
move
public void move(javafx.geometry.Point2D location)
Description copied from interface:MouseRobotMoves the mouse to the given location. Once moved, callsWaitForAsyncUtils.waitForFxEvents().- Specified by:
movein interfaceMouseRobot- Parameters:
location- the location to move the mouse to
-
moveNoWait
public void moveNoWait(javafx.geometry.Point2D location)
Description copied from interface:MouseRobotMoves the mouse to the given location. Once moved,WaitForAsyncUtils.waitForFxEvents()is not called.- Specified by:
moveNoWaitin interfaceMouseRobot- Parameters:
location- the location to move the mouse to without waiting afterwards
-
scroll
public void scroll(int wheelAmount)
Description copied from interface:MouseRobotScrolls the mouse wheel by the given amount. Once scrolled, callsWaitForAsyncUtils.waitForFxEvents().- Specified by:
scrollin interfaceMouseRobot- Parameters:
wheelAmount- the amount to scroll the mouse by
-
scrollNoWait
public void scrollNoWait(int wheelAmount)
Description copied from interface:MouseRobotScrolls the mouse wheel by the given amount. Once scrolled,WaitForAsyncUtils.waitForFxEvents()is not called.- Specified by:
scrollNoWaitin interfaceMouseRobot- Parameters:
wheelAmount- the amount to scroll the mouse by without waiting afterwards
-
getPressedButtons
public final java.util.Set<javafx.scene.input.MouseButton> getPressedButtons()
Description copied from interface:MouseRobotGets the mouse buttons that have been pressed but not yet released.- Specified by:
getPressedButtonsin interfaceMouseRobot- Returns:
- an (unmodifiable) set containing the pressed (but not yet released) buttons
-
pressButton
private void pressButton(javafx.scene.input.MouseButton button)
-
releaseButton
private void releaseButton(javafx.scene.input.MouseButton button)
-
-