public class RectangleInt32 extends Rectangle2D
Rectangle2D.Double, Rectangle2D.Float
Modifier and Type | Field and Description |
---|---|
int |
height
The height of the rectangle
|
int |
width
The width of the rectangle
|
int |
x
The x coordinate of the top left of the rectangle
|
int |
y
The y coordinate of the top right of the rectangle
|
OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP
Constructor and Description |
---|
RectangleInt32()
Creates an empty rectangle at (0,0).
|
RectangleInt32(int width,
int height)
Creates a rectangle with top left corner at (0,0) and with specified
width and height.
|
RectangleInt32(int x,
int y,
int width,
int height)
Creates a rectangle with top left corner at (x,y) and with specified
width and height.
|
RectangleInt32(Point p)
Create an empty rectangle at the given point
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(int x,
int y)
Test if a point given by (x,y) coordinates is within the rectangle
|
boolean |
contains(Point p)
Test if a point is within the rectangle
|
boolean |
contains(RectangleInt32 r)
Test if this rectangle contains a specified rectangle
|
private static int |
doubleToInt(double x,
boolean high) |
boolean |
equals(java.lang.Object obj)
Test if the Rectangle is equal to a given object
|
RectangleInt32 |
getBounds()
Get the bounds of this rectangular shape as a Rectangle
|
Rectangle2D |
getBounds2D()
Get the bounding Rectangle2D for the shape
|
double |
getHeight()
Get the height as a double
|
Point |
getLocation()
Get the location of the rectangle
|
double |
getWidth()
Get the width as a double
|
double |
getX()
Get the x coordinate as a double
|
double |
getY()
Get the y coordinate as a double
|
boolean |
inside(int x,
int y)
Deprecated.
|
boolean |
intersects(RectangleInt32 r)
Test if this rectangle intersects a specified rectangle
|
boolean |
isEmpty()
Test if the rectangle is empty
|
int |
outcode(double x,
double y)
Returns a mask value that specifies where a point lies with respect
to this rectangle.
|
void |
reshape(int x,
int y,
int width,
int height)
Deprecated.
|
void |
resize(int width,
int height)
Deprecated.
|
void |
setBounds(int x,
int y,
int width,
int height)
Set the bounds of this rectangle
|
void |
setBounds(RectangleInt32 r)
Set the bounds of this rectangle to the given rectangle
|
void |
setLocation(int x,
int y)
Move the rectangle to (x,y)
|
void |
setLocation(Point p)
Set the location of this point to the location of a given point
|
void |
setRect(double x,
double y,
double width,
double height)
Set this rectangle to a rectangle defined by double coordinates
|
void |
setSize(int width,
int height)
Set the size of the rectangle
|
java.lang.String |
toString()
Returns a String representing this rectangle.
|
contains, contains, intersects, intersectsLine, outcode, setFrame, setRect
clone, contains, contains, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame
public int height
public int width
public int x
public int y
public RectangleInt32(int x, int y, int width, int height)
x
- the x coordinate of the top left cornery
- the y coordinate of the top left cornerwidth
- the width of the rectangleheight
- the height of the rectanglepublic RectangleInt32(int width, int height)
width
- the width of the rectangleheight
- the height of the rectanglepublic RectangleInt32()
public RectangleInt32(Point p)
p
- trhe pointpublic double getX()
getX
in class RectangularShape
public double getY()
getY
in class RectangularShape
public double getWidth()
getWidth
in class RectangularShape
public double getHeight()
getHeight
in class RectangularShape
public void setLocation(int x, int y)
x
- the new x coordinatey
- the new y coordinatepublic void setLocation(Point p)
p
- the given pointpublic boolean isEmpty()
isEmpty
in class RectangularShape
public boolean contains(int x, int y)
x
- the x coordinatey
- the y coordinatepublic boolean contains(Point p)
p
- the pointpublic boolean contains(RectangleInt32 r)
r
- the specified rectanglepublic boolean intersects(RectangleInt32 r)
r
- the given rectanglepublic RectangleInt32 getBounds()
RectangularShape
getBounds
in interface Shape
getBounds
in class RectangularShape
public Rectangle2D getBounds2D()
Shape
public void setBounds(int x, int y, int width, int height)
x
- the new x coordinatey
- the new y coordinatewidth
- the new widthheight
- the new heightpublic void setBounds(RectangleInt32 r)
r
- the new rectanglepublic void setRect(double x, double y, double width, double height)
Rectangle2D
setRect
in class Rectangle2D
x
- the x coordinate of the top left cornery
- the y coordinate of the top right cornerwidth
- the width of the rectangleheight
- the height of the rectangle@Deprecated public void reshape(int x, int y, int width, int height)
private static int doubleToInt(double x, boolean high)
public boolean equals(java.lang.Object obj)
equals
in class Rectangle2D
obj
- the objectpublic Point getLocation()
public void setSize(int width, int height)
width
- the new widthheight
- the new height@Deprecated public void resize(int width, int height)
public java.lang.String toString()
toString
in class java.lang.Object
public int outcode(double x, double y)
Rectangle2D
outcode
in class Rectangle2D
x
- the x coordinate of the given pointy
- the y coordinate of the given point@Deprecated public boolean inside(int x, int y)