public abstract class Robot extends Object
Modifier and Type | Field and Description |
---|---|
static int |
MOUSE_LEFT_BTN |
static int |
MOUSE_MIDDLE_BTN |
static int |
MOUSE_RIGHT_BTN |
Modifier | Constructor and Description |
---|---|
protected |
Robot() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
_create() |
protected abstract void |
_destroy() |
protected abstract int |
_getMouseX() |
protected abstract int |
_getMouseY() |
protected abstract int |
_getPixelColor(int x,
int y) |
protected abstract Pixels |
_getScreenCapture(int x,
int y,
int width,
int height,
boolean isHiDPI) |
protected abstract void |
_keyPress(int code) |
protected abstract void |
_keyRelease(int code) |
protected abstract void |
_mouseMove(int x,
int y) |
protected abstract void |
_mousePress(int buttons) |
protected abstract void |
_mouseRelease(int buttons) |
protected abstract void |
_mouseWheel(int wheelAmt) |
void |
destroy() |
int |
getMouseX() |
int |
getMouseY() |
int |
getPixelColor(int x,
int y)
Returns pixel color at specified screen coordinates in IntARGB format.
|
Pixels |
getScreenCapture(int x,
int y,
int width,
int height)
Returns a capture of the specified area of the screen.
|
Pixels |
getScreenCapture(int x,
int y,
int width,
int height,
boolean isHiDPI)
Returns a capture of the specified rectangular area of the screen.
|
void |
keyPress(int code)
Generate a key pressed event.
|
void |
keyRelease(int code)
Generate a key released event.
|
void |
mouseMove(int x,
int y)
Generate a mouse moved event.
|
void |
mousePress(int buttons)
Generate a mouse press event with specified buttons mask.
|
void |
mouseRelease(int buttons)
Generate a mouse release event with specified buttons mask.
|
void |
mouseWheel(int wheelAmt)
Generate a mouse wheel event.
|
public static final int MOUSE_LEFT_BTN
public static final int MOUSE_RIGHT_BTN
public static final int MOUSE_MIDDLE_BTN
protected abstract void _create()
protected abstract void _destroy()
public void destroy()
protected abstract void _keyPress(int code)
public void keyPress(int code)
code
- key code for this eventprotected abstract void _keyRelease(int code)
public void keyRelease(int code)
code
- key code for this eventprotected abstract void _mouseMove(int x, int y)
public void mouseMove(int x, int y)
x
- screen coordinate xy
- screen coordinate yprotected abstract void _mousePress(int buttons)
public void mousePress(int buttons)
buttons
- buttons to have generated the eventprotected abstract void _mouseRelease(int buttons)
public void mouseRelease(int buttons)
buttons
- buttons to have generated the eventprotected abstract void _mouseWheel(int wheelAmt)
public void mouseWheel(int wheelAmt)
wheelAmt
- amount the wheel has turned of wheel turningprotected abstract int _getMouseX()
public int getMouseX()
protected abstract int _getMouseY()
public int getMouseY()
protected abstract int _getPixelColor(int x, int y)
public int getPixelColor(int x, int y)
protected abstract Pixels _getScreenCapture(int x, int y, int width, int height, boolean isHiDPI)
public Pixels getScreenCapture(int x, int y, int width, int height, boolean isHiDPI)
isHiDPI
argument is true
, the returned Pixels object
dimensions may differ from the requested width
and height
depending on how many physical pixels the area occupies on the
screen. E.g. in HiDPI mode on the Mac (aka Retina display) the pixels
are doubled, and thus a screen capture of an area of size (10x10) pixels
will result in a Pixels object with dimensions (20x20). Calling code
should use the returned objects's getWidth() and getHeight() methods
to determine the image size.
If (@code isHiDPI) is false
, the returned Pixels object is of
the requested size. Note that in this case the image may be scaled in
order to fit to the requested dimensions if running on a HiDPI display.public Pixels getScreenCapture(int x, int y, int width, int height)
Copyright © 2020. All rights reserved.