public class JavafxRobotAdapter extends java.lang.Object implements RobotAdapter<JavafxRobotAdapter>
RobotAdapter implementation that uses the only the JavaFX public API.
Developer's Note: Forcing the type parameter to be JavafxRobotAdapter is a bit
of a kludge. Ideally we would use a JavafxRobot instead but such a type does
not exist.
| Constructor and Description |
|---|
JavafxRobotAdapter() |
| Modifier and Type | Method and Description |
|---|---|
javafx.scene.paint.Color |
getCapturePixelColor(javafx.geometry.Point2D location)
Gets the color of a pixel at the given JavaFx coordinates.
|
javafx.scene.image.Image |
getCaptureRegion(javafx.geometry.Rectangle2D region)
Captures a region of the screen.
|
javafx.geometry.Point2D |
getMouseLocation()
Returns the current position of the cursor in JavaFx coordinates
|
void |
keyPress(javafx.scene.input.KeyCode key)
Function used to make the robot press a key.
|
void |
keyRelease(javafx.scene.input.KeyCode key)
Function used to make the robot release a key.
|
void |
keyType(javafx.scene.input.KeyCode key,
java.lang.String character) |
void |
mouseClick(javafx.scene.input.MouseButton button) |
void |
mouseClick(javafx.scene.input.MouseButton button,
int clickCount) |
void |
mouseDrag(javafx.scene.input.MouseButton button) |
void |
mouseMove(javafx.geometry.Point2D location)
Moves the mouse cursor to the given position in JavaFx coordinates
|
void |
mousePress(javafx.scene.input.MouseButton button)
Makes the robot press a mouse button.
|
void |
mousePress(javafx.scene.input.MouseButton button,
int clickCount) |
void |
mouseRelease(javafx.scene.input.MouseButton button)
Makes the robot release a mouse button.
|
void |
mouseRelease(javafx.scene.input.MouseButton button,
int clickCount) |
void |
mouseWheel(int wheelAmount)
Makes the robot to simulate a action of the mouse wheel.
Negative values indicate movement up/away from the user, positive values indicate movement down/towards the user. |
void |
robotCreate()
Creates a robot.
|
void |
robotCreate(javafx.scene.Scene scene) |
void |
robotDestroy()
Destroys the robot
|
public void robotCreate(javafx.scene.Scene scene)
public void robotCreate()
RobotAdapterrobotCreate in interface RobotAdapter<JavafxRobotAdapter>public void robotDestroy()
RobotAdapterrobotDestroy in interface RobotAdapter<JavafxRobotAdapter>public void keyPress(javafx.scene.input.KeyCode key)
RobotAdapterkeyPress in interface RobotAdapter<JavafxRobotAdapter>key - the key to press (must exist on a keyboard)public void keyRelease(javafx.scene.input.KeyCode key)
RobotAdapterkeyRelease in interface RobotAdapter<JavafxRobotAdapter>key - the key to press (must exist on a keyboard)public void keyType(javafx.scene.input.KeyCode key,
java.lang.String character)
public javafx.geometry.Point2D getMouseLocation()
RobotAdaptergetMouseLocation in interface RobotAdapter<JavafxRobotAdapter>public void mouseMove(javafx.geometry.Point2D location)
RobotAdaptermouseMove in interface RobotAdapter<JavafxRobotAdapter>location - the location in JavaFx coordinates to move the cursor topublic void mousePress(javafx.scene.input.MouseButton button,
int clickCount)
public void mouseRelease(javafx.scene.input.MouseButton button,
int clickCount)
public void mouseClick(javafx.scene.input.MouseButton button,
int clickCount)
public void mousePress(javafx.scene.input.MouseButton button)
RobotAdaptermousePress in interface RobotAdapter<JavafxRobotAdapter>button - the button to presspublic void mouseRelease(javafx.scene.input.MouseButton button)
RobotAdaptermouseRelease in interface RobotAdapter<JavafxRobotAdapter>button - the button to releasepublic void mouseClick(javafx.scene.input.MouseButton button)
public void mouseDrag(javafx.scene.input.MouseButton button)
public void mouseWheel(int wheelAmount)
RobotAdaptermouseWheel in interface RobotAdapter<JavafxRobotAdapter>wheelAmount - the amount to scrollpublic javafx.scene.paint.Color getCapturePixelColor(javafx.geometry.Point2D location)
RobotAdaptergetCapturePixelColor in interface RobotAdapter<JavafxRobotAdapter>location - of the pixel in JavaFx coordinates, to retrieve the color forpublic javafx.scene.image.Image getCaptureRegion(javafx.geometry.Rectangle2D region)
RobotAdaptergetCaptureRegion in interface RobotAdapter<JavafxRobotAdapter>region - the region to capture in JavaFx coordinates