Class PrivateGlassRobotAdapter
java.lang.Object
org.testfx.service.adapter.impl.GlassRobotAdapter
org.testfx.service.adapter.impl.PrivateGlassRobotAdapter
- All Implemented Interfaces:
RobotAdapter
RobotAdapter implementation that uses the private
com.sun.glass.ui.GlassRobot implementation to support JavaFX versions before 11.
All methods are called reflectively so that this class can compile on any JavaFX version.
-
Field Summary
Fields inherited from class GlassRobotAdapter
glassRobot, RETRIEVAL_TIMEOUT_IN_MILLIS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate javafx.scene.paint.ColorconvertFromGlassColor(int color) private javafx.scene.image.ImageconvertFromGlassPixels(Object glassPixels) private intconvertToButtonId(javafx.scene.input.MouseButton button) javafx.scene.paint.ColorgetCapturePixelColor(javafx.geometry.Point2D location) Gets the color of a pixel at the given JavaFx coordinates.javafx.geometry.Point2DReturns 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.voidCreates a robot.voidDestroys the robotprivate voidwriteIntBufferToImage(IntBuffer intBuffer, javafx.scene.image.WritableImage image) Methods inherited from class GlassRobotAdapter
createGlassRobot, getCaptureRegion, getCaptureRegionRaw, getRobot, mouseWheel
-
Constructor Details
-
PrivateGlassRobotAdapter
PrivateGlassRobotAdapter()
-
-
Method Details
-
robotCreate
-
robotDestroy
-
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
-
convertToButtonId
private int convertToButtonId(javafx.scene.input.MouseButton button) -
convertFromGlassColor
private javafx.scene.paint.Color convertFromGlassColor(int color) -
convertFromGlassPixels
-
writeIntBufferToImage
-