|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectyu.ac.bg.etf.javaqx.qswing.graphics.RectangularShape
yu.ac.bg.etf.javaqx.qswing.graphics.Rectangle
Rectangle Class.
NOTE: This class is immutable.
Nested Class Summary | |
protected static class |
Rectangle.RectanglePathIterator
Rectangle Path Iterator. |
Constructor Summary | |
Rectangle()
Constructs new Rectangle object. |
|
Rectangle(Dimension dimension)
Constructs new Rectangle object. |
|
Rectangle(int width,
int height)
Constructs new Rectangle object. |
|
Rectangle(int x,
int y,
int width,
int height)
Constructs new Rectangle object. |
|
Rectangle(Point location)
Constructs new Rectangle object. |
|
Rectangle(Point location,
Dimension dimension)
Constructs new Rectangle object. |
|
Rectangle(Point topLeft,
Point bottomRight)
Constructs new Rectangle object. |
Method Summary | |
boolean |
contains(int x,
int y)
Returns true if the specified coordinates lie in the shape. |
boolean |
equals(java.lang.Object obj)
|
Rectangle |
getBounds()
Returns a rectangle that completely encloses the shape. |
int |
getHeight()
Returns the height of the framing rectangle. |
Point |
getLocation()
Returns location of the rectangle. |
PathIterator |
getPathIterator()
Returns path iterator that traverses the geometry of the Shape. |
Dimension |
getSize()
Returns dimension of the rectangle. |
int |
getWidth()
Returns the width of the framing rectangle. |
int |
getX()
Returns the x coordinate of the framing rectangle. |
int |
getY()
Returns the y coordinate of the framing rectangle. |
int |
hashCode()
|
Rectangle |
setLocation(int x,
int y)
Returns new rectangle with specified location and dimension of this rectangle. |
Rectangle |
setLocation(Point location)
Returns new rectangle with specified location and dimension of this rectangle. |
Rectangle |
setSize(Dimension dimension)
Returns new rectangle with specified dimension and location of this rectangle. |
Rectangle |
setSize(int width,
int height)
Returns new rectangle with specified dimension and location of this rectangle. |
java.lang.String |
toString()
|
Rectangle |
translate(int dx,
int dy)
Returns translated rectangle at location (x + dx, y + dy). |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Rectangle()
public Rectangle(int x, int y, int width, int height)
x
- the x coordinate of the rectangley
- the y coordinate of the rectanglewidth
- the width of the rectangleheight
- the height of the rectanglepublic Rectangle(Point location, Dimension dimension)
location
- the top-left corner of the rectangledimension
- the dimension of the rectangle
java.lang.IllegalArgumentException
- if location or dimension
is nullpublic Rectangle(Point location)
location
- the top-left corner of the rectanglepublic Rectangle(Point topLeft, Point bottomRight)
topLeft
- the top-left corner of the rectanglebottomRight
- the bottom-right corner of the rectangle
java.lang.IllegalArgumentException
- if topLeft is null,
bottomRight is null or bottomRight is
not bottom-right point.public Rectangle(Dimension dimension)
dimension
- the dimension of the rectanglepublic Rectangle(int width, int height)
width
- the width of the rectangleheight
- the height of the rectangleMethod Detail |
public Point getLocation()
public Rectangle setLocation(int x, int y)
x
- the x coordinate of the locationy
- the y coordinate of the location
public Rectangle setLocation(Point location)
location
- the location
public Dimension getSize()
public Rectangle setSize(int width, int height)
width
- the widthheight
- the height
public Rectangle setSize(Dimension dimension)
dimension
- the dimension
public Rectangle translate(int dx, int dy)
dx
- the distance to move this rectangle along the x axisdy
- the distance to move this rectangle along the y axis
public boolean contains(int x, int y)
x
- the x coordinatey
- the y coordinate
public Rectangle getBounds()
getBounds
in interface Shape
getBounds
in class RectangularShape
public PathIterator getPathIterator()
public boolean equals(java.lang.Object obj)
public int hashCode()
public java.lang.String toString()
public int getX()
getX
in class RectangularShape
public int getY()
getY
in class RectangularShape
public int getWidth()
getWidth
in class RectangularShape
public int getHeight()
getHeight
in class RectangularShape
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |