Package org.testfx.service.adapter.impl
Class PublicGlassRobotAdapter
- java.lang.Object
-
- org.testfx.service.adapter.impl.GlassRobotAdapter
-
- org.testfx.service.adapter.impl.PublicGlassRobotAdapter
-
- All Implemented Interfaces:
RobotAdapter
class PublicGlassRobotAdapter extends GlassRobotAdapter
RobotAdapterimplementation that uses the publicRobotAPI added in JavaFX 11.All methods are called reflectively so that this class can compile on any JavaFX version.
-
-
Field Summary
-
Fields inherited from class org.testfx.service.adapter.impl.GlassRobotAdapter
glassRobot, RETRIEVAL_TIMEOUT_IN_MILLIS
-
-
Constructor Summary
Constructors Constructor Description PublicGlassRobotAdapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javafx.scene.paint.ColorgetCapturePixelColor(javafx.geometry.Point2D location)Gets the color of a pixel at the given JavaFx coordinates.javafx.geometry.Point2DgetMouseLocation()Returns the current position of the cursor in JavaFx coordinatesprotected javafx.scene.image.ImagegetScreenCapture(javafx.geometry.Rectangle2D region, boolean raw)voidkeyPress(javafx.scene.input.KeyCode key)Function used to make the robot press a key.voidkeyRelease(javafx.scene.input.KeyCode key)Function used to make the robot release a key.voidmouseMove(javafx.geometry.Point2D location)Moves the mouse cursor to the given position in JavaFx coordinatesvoidmousePress(javafx.scene.input.MouseButton button)Makes the robot press a mouse button.voidmouseRelease(javafx.scene.input.MouseButton button)Makes the robot release a mouse button.voidrobotCreate()Creates a robot.voidrobotDestroy()Destroys the robot-
Methods inherited from class org.testfx.service.adapter.impl.GlassRobotAdapter
createGlassRobot, getCaptureRegion, getCaptureRegionRaw, getRobot, mouseWheel
-
-
-
-
Method Detail
-
robotCreate
public void robotCreate()
Description copied from interface:RobotAdapterCreates a robot.
-
robotDestroy
public void robotDestroy()
Description copied from interface:RobotAdapterDestroys the robot
-
keyPress
public void keyPress(javafx.scene.input.KeyCode key)
Description copied from interface:RobotAdapterFunction used to make the robot press a key. The key must be a physical existing key on the keyboard.- Parameters:
key- the key to press (must exist on a keyboard)
-
keyRelease
public void keyRelease(javafx.scene.input.KeyCode key)
Description copied from interface:RobotAdapterFunction used to make the robot release a key. The key must be a physical existing key on the keyboard.- Parameters:
key- the key to press (must exist on a keyboard)
-
getMouseLocation
public javafx.geometry.Point2D getMouseLocation()
Description copied from interface:RobotAdapterReturns the current position of the cursor in JavaFx coordinates- Returns:
- the current position of the mouse cursor
-
mouseMove
public void mouseMove(javafx.geometry.Point2D location)
Description copied from interface:RobotAdapterMoves the mouse cursor to the given position in JavaFx coordinates- Parameters:
location- the location in JavaFx coordinates to move the cursor to
-
mousePress
public void mousePress(javafx.scene.input.MouseButton button)
Description copied from interface:RobotAdapterMakes the robot press a mouse button.- Parameters:
button- the button to press
-
mouseRelease
public void mouseRelease(javafx.scene.input.MouseButton button)
Description copied from interface:RobotAdapterMakes the robot release a mouse button.- Parameters:
button- the button to release
-
getCapturePixelColor
public javafx.scene.paint.Color getCapturePixelColor(javafx.geometry.Point2D location)
Description copied from interface:RobotAdapterGets the color of a pixel at the given JavaFx coordinates. The returned Color is in the JavaFx color space. //TODO Due to technical reasons, there might be a deviation in color.- Parameters:
location- of the pixel in JavaFx coordinates, to retrieve the color for- Returns:
- the Color of the given Pixel in the JavaFx color space
-
getScreenCapture
protected javafx.scene.image.Image getScreenCapture(javafx.geometry.Rectangle2D region, boolean raw)- Specified by:
getScreenCapturein classGlassRobotAdapter
-
-