|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectobjectdraw.Drawable
objectdraw.Drawable2D
objectdraw.Resizable2D
objectdraw.Rectangular
abstract class Rectangular
Rectangular is an abstract class that can be specialized to a drawable two-dimensional object.
Field Summary | |
---|---|
protected double |
height
The rectangle's height. |
protected double |
width
The rectangle's width. |
protected double |
x
The upper left corner of the rectangle. |
protected double |
y
The upper left corner of the rectangle. |
Fields inherited from class objectdraw.Drawable |
---|
canvasContent, color, shown |
Constructor Summary | |
---|---|
Rectangular(double x,
double y,
double width,
double height)
Creates a new Rect object. |
|
Rectangular(Location origin,
double width,
double height)
Creates a new Rect object. |
|
Rectangular(Location p0,
Location p1)
Creates a new Rect object. |
Method Summary | |
---|---|
(package private) Bounds |
getBounds()
Retrieves the bounding rectangle of the object. |
double |
getHeight()
Get the height of a graphical object |
double |
getWidth()
Get the width of a graphical object |
(package private) void |
setBounds(Bounds b)
|
void |
setHeight(double height)
Sets the height of the object's bounding rectangle |
void |
setSize(double width,
double height)
Sets the width and height of the rectangle bounding the object. |
void |
setWidth(double width)
Sets the width of the object's bounding rectangle |
Methods inherited from class objectdraw.Resizable2D |
---|
move, moveTo |
Methods inherited from class objectdraw.Drawable2D |
---|
contains, draw, getLocation, getX, getY, overlaps |
Methods inherited from class objectdraw.Drawable |
---|
addToCanvas, clearCanvasContent, getCanvas, getColor, hide, isHidden, moveTo, removeFromCanvas, sendBackward, sendForward, sendToBack, sendToFront, setCanvasContent, setColor, setStateChanged, show |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface objectdraw.Drawable2DInterface |
---|
getLocation, getX, getY, overlaps |
Methods inherited from interface objectdraw.DrawableInterface |
---|
addToCanvas, contains, getCanvas, getColor, hide, isHidden, move, moveTo, moveTo, removeFromCanvas, sendBackward, sendForward, sendToBack, sendToFront, setColor, show |
Field Detail |
---|
protected double height
protected double width
protected double x
protected double y
Constructor Detail |
---|
public Rectangular(double x, double y, double width, double height)
x
- coordinate of the upper left corner of the bounding rectangle.y
- coordinate of the upper left corner of the bounding rectangle.width
- the width of the bounding rectangle.height
- the height of the bounding rectangle.c
- the canvas in which the object is created.public Rectangular(Location origin, double width, double height)
origin
- the upper left corner of the bounding rectangle.width
- the width of the bounding rectangle.height
- the height of the bounding rectangle.c
- the canvas in which the object is created.public Rectangular(Location p0, Location p1)
p0
- endpoint of a diagonal of the rectangle.p1
- other diagonal endpoint.c
- the canvas in which the object is created.Method Detail |
---|
Bounds getBounds()
getBounds
in class Drawable2D
public double getHeight()
Drawable2DInterface
getHeight
in interface Drawable2DInterface
getHeight
in class Drawable2D
public double getWidth()
Drawable2DInterface
getWidth
in interface Drawable2DInterface
getWidth
in class Drawable2D
void setBounds(Bounds b)
setBounds
in class Resizable2D
public void setHeight(double height)
Resizable2DInterface
setHeight
in interface Resizable2DInterface
setHeight
in class Resizable2D
height
- the new height of the bounding rectanglepublic void setSize(double width, double height)
Resizable2DInterface
setSize
in interface Resizable2DInterface
setSize
in class Resizable2D
width
- the new width of the bounding rectangleheight
- the new height of the bounding rectanglepublic void setWidth(double width)
Resizable2DInterface
setWidth
in interface Resizable2DInterface
setWidth
in class Resizable2D
width
- the new width of the bounding rectangle
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |