|
Java DTV API 1.3 18-Nov-2009 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.dtv.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 predefined width and height. |
|
Rectangle(Point p,
int w,
int h)
Create a new instance of Rectangle at a position specified by the Point parameter, and with the predefined
width and height. |
|
Rectangle(Rectangle rect)
A copy Constructor. |
|
Rectangle(Rectangle r)
Creates a new instance of Rectangle with parameters taken from an instance of java.awt.Rectangle . |
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). |
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. |
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. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, 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 rectangle.y
- the y coordinate of the rectangle.size
- the Dimension
of the rectangle.public Rectangle(int x, int y, int w, int h)
x
- the x coordinate of the rectangle.y
- the y coordinate of the rectangle.w
- the width of the rectangle.h
- the height of the rectangle.public Rectangle(Point p, int w, int h)
Point
parameter, and with the predefined
width and height.
p
- the Point specifying the upper left corner of the rectanglew
- the width of the rectangle.h
- the height of the rectangle.public Rectangle(Rectangle rect)
rect
- the Rectangle to copy.public Rectangle(Rectangle r)
java.awt.Rectangle
.
This is a convenience constructor for improvement of the AWT integration.
r
- java.awt.Rectnagle instance to take data from.Method Detail |
---|
public Dimension getSize()
public int getX()
setX(int)
public int getY()
setY(int)
public String toString()
toString
in class Object
public void setX(int x)
x
- the x coordinate of the rectangle.getX()
public void setY(int y)
y
- the y coordinate of the rectangle.getY()
public boolean contains(Rectangle rect)
rect
- the specified Rectangle.
public boolean contains(int rX, int rY, int rWidth, int rHeight)
rX
- the specified x coordinate.rY
- the specified y coordinate.rWidth
- the width of the Rectangle.rHeight
- the height of the Rectangle.
public boolean contains(int rX, int rY)
rX
- the specified x coordinate.rY
- the specified y coordinate.
public boolean intersects(int x, int y, int width, int height)
x
- the specified x coordinate.y
- the specified y coordinate.width
- the width of the Rectangle.height
- 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 coordinate of upper left corner of rectangle 1ty
- y coordinate of upper left corner of rectangle 1tw
- width of rectangle 1th
- height of rectangle 1x
- x coordinate of upper left corner of rectangle 2y
- y coordinate of upper left corner of rectangle 2width
- width of rectangle 2height
- height of rectangle 2
|
Java DTV API 1.3 18-Nov-2009 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |