public class BaseFXRobot extends FXRobot
| Constructor and Description |
|---|
BaseFXRobot(Scene target) |
| Modifier and Type | Method and Description |
|---|---|
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. |
FXRobotImage |
getSceneCapture(int x,
int y,
int w,
int h)
Returns a
FXRobotImage object representing in image with contents
of the scene at specified coordinates, or null if scene pixel capturing
isn't supported. |
void |
keyPress(KeyCode keyCode)
Generate a key pressed event.
|
void |
keyRelease(KeyCode keyCode)
Generate a key released event.
|
void |
keyType(KeyCode keyCode,
String keyChar)
Generate a key typed event.
|
void |
mouseClick(MouseButton button,
int clickCount)
Generate a mouse clicked event with specified click count.
|
void |
mouseDrag(MouseButton button)
Generate a mouse dragged event.
|
void |
mouseMove(int x,
int y)
Generate a mouse moved event.
|
void |
mousePress(MouseButton button,
int clickCount)
Generate a mouse press event with specified click count.
|
void |
mouseRelease(MouseButton button,
int clickCount)
Generate a mouse release event with specified click count.
|
void |
mouseWheel(int wheelAmt)
Generate a mouse wheel event.
|
void |
waitForIdle()
Block until events in the queue are processed.
|
mouseClick, mousePress, mouseRelease, setAutoWaitForIdlepublic BaseFXRobot(Scene target)
public void waitForIdle()
FXRobotwaitForIdle in class FXRobotpublic void keyPress(KeyCode keyCode)
FXRobotpublic void keyRelease(KeyCode keyCode)
FXRobotFXRobot.keyType(javafx.scene.input.KeyCode, java.lang.String) will
need to be called explicitly.keyRelease in class FXRobotkeyCode - key code for this eventpublic void keyType(KeyCode keyCode, String keyChar)
FXRobotkeyChar 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".public void mouseMove(int x,
int y)
FXRobotpublic void mousePress(MouseButton button, int clickCount)
FXRobotpress/release/click followed by press(2)/release(2)/click(2)mousePress in class FXRobotbutton - button to have generated the eventclickCount - number of clicks for this eventpublic void mouseRelease(MouseButton button, int clickCount)
FXRobotFXRobot.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)mouseRelease in class FXRobotbutton - button to have generated the eventclickCount - number of clicks for this eventpublic void mouseClick(MouseButton button, int clickCount)
FXRobotpress/release/click followed by press(2)/release(2)/click(2)mouseClick in class FXRobotbutton - button to have generated the eventclickCount - number of clicks for this eventpublic void mouseDrag(MouseButton button)
FXRobotpublic void mouseWheel(int wheelAmt)
FXRobotmouseWheel in class FXRobotwheelAmt - amount the wheel has turned of wheel turningpublic int getPixelColor(int x,
int y)
FXRobot0 if the passed coordinates are outside of the scene's bounds or
if pixel grabbing isn't supported.getPixelColor in class FXRobotx - scene coordinatey - scene coordinate0 if outside of scene
bounds or if pixel grabbing isn't supportedpublic FXRobotImage getSceneCapture(int x, int y, int w, int h)
FXRobotFXRobotImage 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.getSceneCapture in class FXRobotx - scene coordinatey - scene coordinatew - of the area to captureh - of the area to captureFXRobotImage containing captured pixels or null if pixel
capturing isn't supprotedCopyright © 2025. All rights reserved.