|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.lwuit.geom.Rectangle
public class Rectangle
Represents a Rectangle position (x, y) and Dimension
(width, height),
this is useful for measuring coordinates within the application.
Constructor Summary | |
---|---|
Rectangle()
Creates a new instance of Rectangle |
|
Rectangle(int x,
int y,
Dimension size)
Creates a new instance of Rectangle at position (x, y) and with predefine dimension |
|
Rectangle(int x,
int y,
int w,
int h)
Creates a new instance of Rectangle at position (x, y) and with predefine width and height |
|
Rectangle(Rectangle rect)
A copy Constructor |
Method Summary | |
---|---|
boolean |
contains(int rX,
int rY)
Checks whether or not this Rectangle contains the point at the specified location (rX, rY). |
boolean |
contains(int rX,
int rY,
int rWidth,
int rHeight)
Checks whether this Rectangle entirely contains the Rectangle at the specified location (rX, rY) with the specified dimensions (rWidth, rHeight). |
static boolean |
contains(int x1,
int y1,
int w1,
int h1,
int x2,
int y2,
int w2,
int h2)
Checks wheather the 2nd rectangle is contained in the first rectangle |
boolean |
contains(Rectangle rect)
Checks whether or not this Rectangle entirely contains the specified Rectangle. |
Dimension |
getSize()
Return the dimension of the rectangle |
int |
getX()
Return the x coordinate of the rectangle |
int |
getY()
Return the y coordinate of the rectangle |
Rectangle |
intersection(int rX,
int rY,
int rW,
int rH)
Returns a rectangle that intersects the given rectangle with this rectangle |
Rectangle |
intersection(Rectangle r)
Returns a rectangle that intersects the given rectangle with this rectangle |
boolean |
intersects(int x,
int y,
int width,
int height)
Determines whether or not this Rectangle and the specified Rectangle location (x, y) with the specified dimensions (width, height), intersect. |
static boolean |
intersects(int tx,
int ty,
int tw,
int th,
int x,
int y,
int width,
int height)
Helper method allowing us to determine if two coordinate sets intersect. |
boolean |
intersects(Rectangle rect)
Determines whether or not this Rectangle and the specified Rectangle location (x, y) with the specified dimensions (width, height), intersect. |
void |
setX(int x)
Sets the x position of the rectangle |
void |
setY(int y)
Sets the y position of the rectangle |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Rectangle()
public Rectangle(int x, int y, Dimension size)
x
- the x coordinate of the rectangley
- the y coordinate of the rectanglesize
- the Dimension
of the rectanglepublic Rectangle(int x, int y, int w, int h)
x
- the x coordinate of the rectangley
- the y coordinate of the rectanglew
- the width of the rectangleh
- the height of the rectanglepublic Rectangle(Rectangle rect)
rect
- the Rectangle to copyMethod Detail |
---|
public Dimension getSize()
public int getX()
public int getY()
public java.lang.String toString()
toString
in class java.lang.Object
public void setX(int x)
x
- the x coordinate of the rectanglepublic void setY(int y)
y
- the y coordinate of the rectanglepublic boolean contains(Rectangle rect)
rect
- the specified Rectangle
public boolean contains(int rX, int rY, int rWidth, int rHeight)
rX
- the specified x coordinaterY
- the specified y coordinaterWidth
- the width of the RectanglerHeight
- the height of the Rectangle
public static boolean contains(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2)
x1
- first rect xy1
- first rect yw1
- first rect wh1
- first rect hx2
- second rect xy2
- second rect yw2
- second rect wh2
- second rect h
public boolean contains(int rX, int rY)
rX
- the specified x coordinaterY
- the specified y coordinate
public Rectangle intersection(int rX, int rY, int rW, int rH)
rX
- rectangle to intersect with this rectanglerY
- rectangle to intersect with this rectanglerW
- rectangle to intersect with this rectanglerH
- rectangle to intersect with this rectangle
public Rectangle intersection(Rectangle r)
r
- rectangle to intersect with this rectangle
public boolean intersects(int x, int y, int width, int height)
x
- the specified x coordinatey
- the specified y coordinatewidth
- the width of the Rectangleheight
- the height of the Rectangle
public boolean intersects(Rectangle rect)
rect
- the Rectangle to check intersection with
public static boolean intersects(int tx, int ty, int tw, int th, int x, int y, int width, int height)
tx
- x of first rectanglety
- y of first rectangletw
- width of first rectangleth
- height of first rectanglex
- x of second rectangley
- y of second rectanglewidth
- width of second rectangleheight
- height of second rectangle
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |