public class Screen extends Region implements EventObserver, IScreen
Modifier and Type | Field and Description |
---|---|
protected GraphicsDevice |
curGD |
protected int |
curID |
protected static GraphicsDevice[] |
gdevs |
protected static GraphicsEnvironment |
genv |
protected ScreenImage |
lastScreenImage |
protected static int |
primaryScreen |
protected OverlayCapturePrompt |
prompt |
protected RobotDesktop |
robot |
protected static Screen[] |
screens |
protected boolean |
waitPrompt |
CREATE_X_DIRECTION_LEFT, CREATE_X_DIRECTION_RIGHT, CREATE_Y_DIRECTION_BOTTOM, CREATE_Y_DIRECTION_TOP, h, w, x, y
Constructor and Description |
---|
Screen()
Is the screen object having the top left corner as (0,0).
|
Screen(int id)
Is the screen object at the given id
|
Modifier and Type | Method and Description |
---|---|
ScreenImage |
capture()
create a ScreenImage with the physical bounds of this screen
|
ScreenImage |
capture(int x,
int y,
int w,
int h)
create a ScreenImage with given coordinates on this screen.
|
ScreenImage |
capture(Rectangle rect)
create a ScreenImage with given rectangle on this screen.
|
ScreenImage |
capture(Region reg)
create a ScreenImage with given region on this screen
|
Rectangle |
getBounds() |
static Rectangle |
getBounds(int id) |
GraphicsDevice |
getGraphicsDevice() |
int |
getID() |
static int |
getNumberScreens() |
static int |
getPrimaryId() |
static Screen |
getPrimaryScreen() |
RobotDesktop |
getRobot()
Gets the Robot of this Screen.
|
static RobotDesktop |
getRobot(int id)
each screen has exactly one robot (internally used for screen capturing)
available as a convenience for those who know what they are doing. |
Screen |
getScreen() |
static Screen |
getScreen(int id) |
protected void |
initScreen(Screen scr)
Detects on which Screen the Region is present.
|
Location |
newLocation(Location loc)
creates a location on the current screen with the given point.
|
Region |
newRegion(Location loc,
int width,
int height)
creates a region on the current screen with the given coordinate/size.
|
static void |
resetMonitors()
re-initialize the monitor setup (e.g.
|
Region |
selectRegion()
interactive region create with predefined message: lets the user draw the rectangle using the
mouse
|
Region |
selectRegion(String msg)
interactive region create with given message: lets the user draw the rectangle using the mouse
|
protected void |
setScreen(Screen s)
Sets a new Screen for this region.
|
static void |
showMonitors()
show the current monitor setup
|
protected void |
showTarget(Location loc) |
protected void |
showTarget(Location loc,
double secs) |
String |
toString() |
String |
toStringShort()
only a short version of toString()
|
void |
update(EventSubject s)
Internal use only
|
protected boolean |
useFullscreen() |
ScreenImage |
userCapture()
interactive capture with predefined message: lets the user capture a screen image using the
mouse to draw the rectangle
|
ScreenImage |
userCapture(String msg)
interactive capture with given message: lets the user capture a screen image using the mouse to
draw the rectangle
|
above, above, aboveAt, aboveAt, add, add, add, atMouse, below, below, belowAt, belowAt, click, click, click, contains, contains, containsMouse, copyTo, copyTo, create, create, create, create, create, create, doubleClick, doubleClick, doubleClick, drag, dragDrop, dragDrop, dropAt, exists, exists, find, findAll, findAllText, findAllText, findText, findText, getAutoWaitTimeout, getBottomLeft, getBottomRight, getCenter, getEvtMgr, getFindFailedResponse, getH, getLastMatch, getLastMatches, getLastScreenImage, getLastScreenImageFile, getLastScreenImageFile, getLastScreenImageFile, getObserveScanRate, getRect, getScreenContaining, getTarget, getThrowException, getTopLeft, getTopRight, getW, getWaitForVanish, getWaitScanRate, getX, getY, grow, grow, grow, grow, grow, grow, highlight, highlight, highlight, hover, hover, inside, intersection, isObserving, keyDown, keyDown, keyUp, keyUp, keyUp, left, left, leftAt, leftAt, listText, morphTo, mouseDown, mouseMove, mouseMove, mouseUp, mouseUp, moveTo, nearby, nearby, observe, observe, observeInBackground, offset, offset, onAppear, onChange, onChange, onVanish, paste, paste, regionOnScreen, resetScreens, right, right, rightAt, rightAt, rightClick, rightClick, rightClick, setAutoWaitTimeout, setBottomLeft, setBottomRight, setCenter, setEvtMgr, setFindFailedResponse, setH, setLocation, setObserveScanRate, setRect, setRect, setRect, setROI, setROI, setROI, setScreen, setSize, setThrowException, setTopLeft, setTopRight, setW, setWaitForVanish, setWaitScanRate, setX, setY, showScreens, stopObserver, text, toGlobalCoord, type, type, type, type, type, type, union, updateSelf, wait, wait, wait, waitVanish, waitVanish, wheel, wheel
protected static GraphicsEnvironment genv
protected static GraphicsDevice[] gdevs
protected RobotDesktop robot
protected static Screen[] screens
protected static int primaryScreen
protected int curID
protected GraphicsDevice curGD
protected boolean waitPrompt
protected OverlayCapturePrompt prompt
protected ScreenImage lastScreenImage
public Screen(int id) throws Exception
id
- Exception
- TODO: implement an own Exception instead of using the Exception classpublic Screen()
protected void initScreen(Screen scr)
initScreen
in class Region
scr
- The Screen containing the Regionpublic Screen getScreen()
protected void setScreen(Screen s)
public static void showMonitors()
public static void resetMonitors()
protected boolean useFullscreen()
public static int getNumberScreens()
public static int getPrimaryId()
public static Screen getPrimaryScreen()
public static Screen getScreen(int id)
id
- of the screenpublic static Rectangle getBounds(int id)
id
- public static RobotDesktop getRobot(int id)
id
- public int getID()
public GraphicsDevice getGraphicsDevice()
public RobotDesktop getRobot()
public Region newRegion(Location loc, int width, int height)
loc
- width
- height
- public Location newLocation(Location loc)
loc
- public ScreenImage capture()
public ScreenImage capture(int x, int y, int w, int h)
public ScreenImage capture(Rectangle rect)
public ScreenImage capture(Region reg)
public ScreenImage userCapture()
public ScreenImage userCapture(String msg)
public Region selectRegion()
public Region selectRegion(String msg)
public void update(EventSubject s)
update
in interface EventObserver
s
- protected void showTarget(Location loc)
protected void showTarget(Location loc, double secs)
public String toStringShort()
toStringShort
in class Region