public class BaseFXRobot extends FXRobot
| Modifier and Type | Field and Description |
|---|---|
private static boolean |
debugOut |
private boolean |
isAltDown |
private boolean |
isButton1Pressed |
private boolean |
isButton2Pressed |
private boolean |
isButton3Pressed |
private boolean |
isControlDown |
private boolean |
isMetaDown |
private boolean |
isShiftDown |
private static java.util.Map<KeyCode,java.lang.String> |
keyTextMap |
private MouseButton |
lastButtonPressed |
private FXRobotImage |
lastConvertedImage |
private java.lang.Object |
lastImage |
private double |
sceneMouseX |
private double |
sceneMouseY |
private double |
screenMouseX |
private double |
screenMouseY |
private Scene |
target |
| Constructor and Description |
|---|
BaseFXRobot(Scene target) |
| Modifier and Type | Method and Description |
|---|---|
private static boolean |
computeDebugOut() |
private void |
doKeyEvent(EventType<KeyEvent> eventType,
KeyCode keyCode,
java.lang.String character) |
private void |
doMouseEvent(double x,
double y,
MouseButton passedButton,
int clickCount,
EventType<MouseEvent> passedType) |
private void |
doScrollEvent(double x,
double y,
double rotation,
EventType<ScrollEvent> type) |
private static java.lang.String |
getKeyText(KeyCode keyCode) |
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,
java.lang.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.
|
private static void |
out(java.lang.String s) |
void |
waitForIdle()
Block until events in the queue are processed.
|
mouseClick, mousePress, mouseRelease, setAutoWaitForIdleprivate static final boolean debugOut
private static java.util.Map<KeyCode,java.lang.String> keyTextMap
private Scene target
private boolean isShiftDown
private boolean isControlDown
private boolean isAltDown
private boolean isMetaDown
private boolean isButton1Pressed
private boolean isButton2Pressed
private boolean isButton3Pressed
private MouseButton lastButtonPressed
private double sceneMouseX
private double sceneMouseY
private double screenMouseX
private double screenMouseY
private java.lang.Object lastImage
private FXRobotImage lastConvertedImage
public BaseFXRobot(Scene target)
private static boolean computeDebugOut()
private static void out(java.lang.String s)
private static java.lang.String getKeyText(KeyCode keyCode)
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, java.lang.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 supprotedprivate void doKeyEvent(EventType<KeyEvent> eventType, KeyCode keyCode, java.lang.String character)
private void doMouseEvent(double x,
double y,
MouseButton passedButton,
int clickCount,
EventType<MouseEvent> passedType)
private void doScrollEvent(double x,
double y,
double rotation,
EventType<ScrollEvent> type)