Package org.sikuli.script
Class Location
java.lang.Object
org.sikuli.script.Location
- All Implemented Interfaces:
Comparable<Location>
public class Location extends Object implements Comparable<Location>
A point like AWT.Point using global coordinates (x, y).
hence modifications might move location out of
any screen (not checked as is done with region)
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description Locationabove(int dy)creates a point at the given offset above, might be negative
might create a point outside of any screen, not checkedLocationbelow(int dy)creates a point at the given offset below, might be negative
might create a point outside of any screen, not checkedLocationclick()Move the mouse to this location point and click leftintcompareTo(Location loc)LocationcopyTo(int scrID)new point with same offset to current screen's top left on given screenLocationcopyTo(IScreen screen)New point with same offset to current screen's top left on given screenLocationdoubleClick()Move the mouse to this location point and double click leftbooleanequals(Object oThat)ColorgetColor()Get the color at the given Point for details: see java.awt.Robot and ...Colorstatic LocationgetDefaultInstance4py()ScreengetMonitor()Returns primary screen, if outside of any screen or not contained in a non-Desktop Screen instance (e.g. remote screen)OffsetgetOffset(Location loc)the offset of given point to this LocationPointgetPoint()get as AWT pointprotected IRobotgetRobotForPoint(String action)IScreengetScreen()Returns null, if outside of any screen and not contained in a non-Desktop Screen instance (e.g. remote screen)
subsequent actions WILL crash if not tested for null returnintgetX()intgetY()Regiongrow()create a region with this point as center and size Settings.DefaultPaddingRegiongrow(int wh)create a region with this point as center and the given sizeRegiongrow(int w, int h)create a region with this point as center and the given sizeRegiongrow(int CREATE_X_DIRECTION, int CREATE_Y_DIRECTION, int w, int h)create a region with a corner at this point
as specified with x y
0 0 top left
0 1 bottom left
1 0 top right
1 1 bottom rightLocationhover()Move the mouse to this location pointbooleanisOtherScreen()INTERNAL USE reveals wether the containing screen is a DeskTopScreen or notLocationleft(int dx)creates a point at the given offset to the left, might be negative
might create a point outside of any screen, not checkedstatic Locationmake4py(ArrayList args)Locationmove(int X, int Y)convenience: like awt pointLocationmoveFor(int dx, int dy)Deprecated.LocationmoveTo(int X, int Y)Deprecated.usemove(int, int)Locationoffset(int dx, int dy)creates a point at the given offset, might be negative
might create a point outside of any screen, not checkedLocationoffset(Object whatever)creates a point at the given offset, might be negative
might create a point outside of any screen, not checkedLocationright(int dx)creates a point at the given offset to the right, might be negative
might create a point outside of any screen, not checkedLocationrightClick()Move the mouse to this location point and click rightLocationset(double x, double y)sets the coordinates to the given values (moves it)Locationset(int x, int y)sets the coordinates to the given values (moves it)LocationsetOtherScreen(IScreen scr)INTERNAL USE identifies the point as being on a non-desktop-screenLocationsetX(double x)sets x to the given valueLocationsetX(int x)sets x to the given valueLocationsetY(double y)sets y to the given valueLocationsetY(int y)sets y to the given valueStringtoJSON()StringtoString()StringtoStringShort()Locationtranslate(int dx, int dy)convenience: like awt pointRegionunion(Location loc)creates aRegionwith the given points as top-left and bottom-right corners
-
Field Details
-
Constructor Details
-
Location
public Location(double x, double y)to allow calculated x and y that might not be integers- Parameters:
x- columny- row truncated to the integer part
-
Location
public Location(int x, int y)a new point at the given coordinates- Parameters:
x- columny- row
-
Location
-
Location
duplicates the point- Parameters:
loc- other Location
-
Location
create from AWT point- Parameters:
point- a Point
-
-
Method Details
-
getDefaultInstance4py
-
make4py
-
setX
sets x to the given value- Parameters:
x- new x- Returns:
- this
-
setX
sets x to the given value- Parameters:
x- new x- Returns:
- this
-
getX
public int getX()- Returns:
- x value
-
setY
sets y to the given value- Parameters:
y- new y- Returns:
- this
-
setY
sets y to the given value- Parameters:
y- new y- Returns:
- this
-
getY
public int getY()- Returns:
- y value
-
set
sets the coordinates to the given values (moves it)- Parameters:
x- new x might be non-inty- new y might be non-int- Returns:
- this
-
set
sets the coordinates to the given values (moves it)- Parameters:
x- new x doubley- new y double- Returns:
- this
-
getPoint
get as AWT point- Returns:
- Point
-
isOtherScreen
public boolean isOtherScreen()INTERNAL USE reveals wether the containing screen is a DeskTopScreen or not- Returns:
- null if DeskTopScreen
-
setOtherScreen
INTERNAL USE identifies the point as being on a non-desktop-screen- Parameters:
scr- Screen- Returns:
- this
-
getScreen
Returns null, if outside of any screen and not contained in a non-Desktop Screen instance (e.g. remote screen)
subsequent actions WILL crash if not tested for null return- Returns:
- the screen, that contains the given point
-
getMonitor
Returns primary screen, if outside of any screen or not contained in a non-Desktop Screen instance (e.g. remote screen)- Returns:
- the real screen, that contains the given point
-
getColor
Get the color at the given Point for details: see java.awt.Robot and ...Color- Returns:
- The Color of the Point
-
grow
create a region with this point as center and size Settings.DefaultPadding- Returns:
- the new region
-
grow
create a region with this point as center and the given size- Parameters:
w- the widthh- the height- Returns:
- the new region
-
grow
create a region with this point as center and the given size- Parameters:
wh- the width and height- Returns:
- the new region
-
grow
create a region with a corner at this point
as specified with x y
0 0 top left
0 1 bottom left
1 0 top right
1 1 bottom right- Parameters:
CREATE_X_DIRECTION- == 0 is left side !=0 is right side, seeRegion.LEFT,Region.RIGHTCREATE_Y_DIRECTION- == 0 is top side !=0 is bottom side, seeRegion.TOP,Region.BOTTOMw- the widthh- the height- Returns:
- the new region
-
union
creates aRegionwith the given points as top-left and bottom-right corners- Parameters:
loc- the other corner- Returns:
- a new Region
-
moveFor
Deprecated.moves the point the given amounts in the x and y direction, might be negative
might move point outside of any screen, not checked- Parameters:
dx- x offsetdy- y offset- Returns:
- the location itself modified
-
translate
convenience: like awt point- Parameters:
dx- x offsetdy- y offset- Returns:
- the location itself modified
-
moveTo
Deprecated.usemove(int, int)changes the locations x and y value to the given values (moves it)
might move point outside of any screen, not checked- Parameters:
X- new xY- new y- Returns:
- the location itself modified
-
move
convenience: like awt point- Parameters:
X- new xY- new y- Returns:
- the location itself modified
-
getOffset
the offset of given point to this Location- Parameters:
loc- the other Location- Returns:
- relative offset
-
copyTo
new point with same offset to current screen's top left on given screen- Parameters:
scrID- number of screen- Returns:
- new location
-
copyTo
New point with same offset to current screen's top left on given screen- Parameters:
screen- new parent screen- Returns:
- new location
-
offset
creates a point at the given offset, might be negative
might create a point outside of any screen, not checked- Parameters:
dx- x offsetdy- y offset- Returns:
- new location
-
offset
creates a point at the given offset, might be negative
might create a point outside of any screen, not checked- Parameters:
whatever- offset taken from Region, Match, Image, Location or Offset- Returns:
- new location relocated with offset
-
left
creates a point at the given offset to the left, might be negative
might create a point outside of any screen, not checked- Parameters:
dx- x offset- Returns:
- new location
-
right
creates a point at the given offset to the right, might be negative
might create a point outside of any screen, not checked- Parameters:
dx- x offset- Returns:
- new location
-
above
creates a point at the given offset above, might be negative
might create a point outside of any screen, not checked- Parameters:
dy- y offset- Returns:
- new location
-
below
creates a point at the given offset below, might be negative
might create a point outside of any screen, not checked- Parameters:
dy- y offset- Returns:
- new location
-
hover
Move the mouse to this location point- Returns:
- this
-
click
Move the mouse to this location point and click left- Returns:
- this
-
doubleClick
Move the mouse to this location point and double click left- Returns:
- this
-
rightClick
Move the mouse to this location point and click right- Returns:
- this
-
equals
-
compareTo
- Specified by:
compareToin interfaceComparable<Location>- Parameters:
loc- other Location- Returns:
- -1 if given point is more above and/or left, 1 otherwise (0 is equal)
-
toString
-
toStringShort
- Returns:
- a shorter description
-
toJSON
-
getRobotForPoint
-