public abstract class FXRobot
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected boolean |
autoWait |
Constructor and Description |
---|
FXRobot() |
Modifier and Type | Method and Description |
---|---|
abstract int |
getPixelColor(int x,
int y)
Returns pixel color at specified scene coordinates in IntARGB format,
0 if the passed coordinates are outside of the scene's bounds or
if pixel grabbing isn't supported. |
abstract FXRobotImage |
getSceneCapture(int x,
int y,
int width,
int height)
Returns a
FXRobotImage object representing in image with contents
of the scene at specified coordinates, or null if scene pixel capturing
isn't supported. |
abstract void |
keyPress(KeyCode code)
Generate a key pressed event.
|
abstract void |
keyRelease(KeyCode code)
Generate a key released event.
|
abstract void |
keyType(KeyCode code,
java.lang.String keyChar)
Generate a key typed event.
|
void |
mouseClick(MouseButton button)
Generate a mouse clicked event with click count of 1.
|
abstract void |
mouseClick(MouseButton button,
int clickCount)
Generate a mouse clicked event with specified click count.
|
abstract void |
mouseDrag(MouseButton button)
Generate a mouse dragged event.
|
abstract void |
mouseMove(int x,
int y)
Generate a mouse moved event.
|
void |
mousePress(MouseButton button)
Generate a mouse pressed event with click count of 1.
|
abstract void |
mousePress(MouseButton button,
int clickCount)
Generate a mouse press event with specified click count.
|
void |
mouseRelease(MouseButton button)
Generate a mouse pressed event with click count of 1.
|
abstract void |
mouseRelease(MouseButton button,
int clickCount)
Generate a mouse release event with specified click count.
|
abstract void |
mouseWheel(int wheelAmt)
Generate a mouse wheel event.
|
void |
setAutoWaitForIdle(boolean wait)
Whether to wait for events to be processed after each robot command
|
abstract void |
waitForIdle()
Block until events in the queue are processed.
|
public abstract void waitForIdle()
public void setAutoWaitForIdle(boolean wait)
wait
- if true, wait until events in the queue are processedpublic abstract void keyPress(KeyCode code)
code
- key code for this eventpublic abstract void keyRelease(KeyCode code)
keyType(javafx.scene.input.KeyCode, java.lang.String)
will
need to be called explicitly.code
- key code for this eventpublic abstract void keyType(KeyCode code, java.lang.String keyChar)
keyChar
argument will need to
depend on what character is generated by this event. That is, the user
will need to take into account different modifiers currently applied and
so forth. If shift is presumed to be pressed, the char will be "A",
otherwise it will be "a".code
- key code for this eventkeyChar
- char for this eventpublic abstract void mouseMove(int x, int y)
x
- scene coordinate xy
- scene coordinate ypublic abstract void mousePress(MouseButton button, int clickCount)
press/release/click
followed by press(2)/release(2)/click(2)
button
- button to have generated the eventclickCount
- number of clicks for this eventpublic abstract void mouseRelease(MouseButton button, int clickCount)
mouseClick(javafx.scene.input.MouseButton)
for that.
Note that a multi-click gesture consists of multiple sets of
MousePressed/MouseReleased/MouseClicked events, with second and following
sets having appropriate click count set.
press/release/click
followed by press(2)/release(2)/click(2)
button
- button to have generated the eventclickCount
- number of clicks for this eventpublic abstract void mouseClick(MouseButton button, int clickCount)
press/release/click
followed by press(2)/release(2)/click(2)
button
- button to have generated the eventclickCount
- number of clicks for this eventpublic void mousePress(MouseButton button)
button
- button to have generated the eventpublic void mouseRelease(MouseButton button)
mouseClick(javafx.scene.input.MouseButton)
for that.button
- button to have generated the eventpublic void mouseClick(MouseButton button)
button
- button to have generated the eventpublic abstract void mouseDrag(MouseButton button)
button
- button to have generated the eventpublic abstract void mouseWheel(int wheelAmt)
wheelAmt
- amount the wheel has turned of wheel turningpublic abstract int getPixelColor(int x, int y)
0
if the passed coordinates are outside of the scene's bounds or
if pixel grabbing isn't supported.x
- scene coordinatey
- scene coordinate0
if outside of scene
bounds or if pixel grabbing isn't supportedpublic abstract FXRobotImage getSceneCapture(int x, int y, int width, int height)
FXRobotImage
object representing in image with contents
of the scene at specified coordinates, or null if scene pixel capturing
isn't supported.
Implementation note: current implementation ignores passed parameters and
always captures complete scene.x
- scene coordinatey
- scene coordinatewidth
- of the area to captureheight
- of the area to captureFXRobotImage
containing captured pixels or null if pixel
capturing isn't supproted