public class Location extends Object
Constructor and Description |
---|
Location(float _x,
float _y)
to allow calculated x and y that might not be integers
|
Location(int _x,
int _y) |
Location(Location loc) |
Location(Point point) |
Modifier and Type | Method and Description |
---|---|
Location |
above(int dy)
creates a point at the given offset above, might be negative
might create a point outside of any screen, not checked |
Location |
below(int dy)
creates a point at the given offset below, might be negative
might create a point outside of any screen, not checked |
Location |
copyTo(int scrID)
new point with same offset to current screen's top left on given screen
|
Location |
copyTo(Screen screen)
New point with same offset to current screen's top left on given screen
|
Color |
getColor()
Get the color at the given Point for details: see java.awt.Robot and ...Color
|
Location |
getOffset(Location loc)
the offset of given point as (x,y) relative to this point
|
Screen |
getScreen()
Returns null, if outside of any screen
subsequent actions will crash |
int |
getX() |
int |
getY() |
Region |
grow(int wh)
create a region with this point as center and the given size
|
Region |
grow(int w,
int h)
create a region with this point as center and the given size
|
Region |
grow(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 right |
Location |
left(int dx)
creates a point at the given offset to the left, might be negative
might create a point outside of any screen, not checked |
Location |
move(int X,
int Y)
convenience: like awt point
|
Location |
moveFor(int dx,
int dy)
moves the point the given amounts in the x and y direction, might be negative
might move point outside of any screen, not checked |
Location |
moveTo(int X,
int Y)
changes the locations x and y value to the given values (moves it)
might move point outside of any screen, not checked |
Location |
offset(int dx,
int dy)
creates a point at the given offset, might be negative
might create a point outside of any screen, not checked |
Location |
right(int dx)
creates a point at the given offset to the right, might be negative
might create a point outside of any screen, not checked |
Location |
setLocation(float _x,
float _y)
sets the coordinates to the given values
|
Location |
setLocation(int _x,
int _y)
sets the coordinates to the given values
|
String |
toString() |
String |
toStringShort() |
Location |
translate(int dx,
int dy)
convenience: like awt point
|
public Location(float _x, float _y)
x
- y
- truncated to the integer partpublic Location(int _x, int _y)
x
- y
- public Location(Location loc)
loc
- public Location(Point point)
point
- public int getX()
public int getY()
public Location setLocation(int _x, int _y)
_x
- _y
- public Location setLocation(float _x, float _y)
_x
- _y
- public Screen getScreen()
public Color getColor()
public Location getOffset(Location loc)
loc1
- loc2
- public Region grow(int w, int h)
w
- the widthh
- the heightpublic Region grow(int wh)
wh
- the width and heightpublic Region grow(int CREATE_X_DIRECTION, int CREATE_Y_DIRECTION, int w, int h)
CREATE_X_DIRECTION
- == 0 is left side !=0 is right side, see Region.CREATE_X_DIRECTION_LEFT
, Region.CREATE_X_DIRECTION_RIGHT
CREATE_Y_DIRECTION
- == 0 is top side !=0 is bottom side, see Region.CREATE_Y_DIRECTION_TOP
, Region.CREATE_Y_DIRECTION_BOTTOM
w
- the widthh
- the heightpublic Location moveFor(int dx, int dy)
dx
- dy
- public Location translate(int dx, int dy)
dx
- dy
- public Location moveTo(int X, int Y)
X
- Y
- public Location move(int X, int Y)
X
- Y
- public Location offset(int dx, int dy)
dx
- dy
- public Location left(int dx)
dx
- public Location right(int dx)
dx
- public Location above(int dy)
dy
- public Location below(int dy)
dy
- public Location copyTo(int scrID)
scrID
- number of screenpublic Location copyTo(Screen screen)
screen
- new parent screenpublic String toStringShort()