|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectdiva.canvas.AbstractFigure
diva.canvas.tutorial.FigureTutorial.CustomRectangle
public static class FigureTutorial.CustomRectangle
CustomRectangle is a class that paints itself as a rectangle and draw a red plus sign over the top of itself. This example figure class illustrates the use of different paints and strokes to create the required image. It overrides only the absolute minimum number of methods that must be overridden to create a new figure class.
| Field Summary | |
|---|---|
private java.awt.geom.Rectangle2D |
_bounds
|
| Constructor Summary | |
|---|---|
FigureTutorial.CustomRectangle(double x,
double y,
double width,
double height)
Create a new instance of this figure. |
|
| Method Summary | |
|---|---|
java.awt.geom.Rectangle2D |
getBounds()
Get the bounds of this figure. |
java.awt.Shape |
getShape()
Get the shape of this figure. |
void |
paint(java.awt.Graphics2D g)
Paint this figure onto the given graphics context. |
void |
transform(java.awt.geom.AffineTransform at)
Transform the object. |
| Methods inherited from class diva.canvas.AbstractFigure |
|---|
contains, getInteractor, getLayer, getOrigin, getParent, getToolTipText, getTransformContext, getUserObject, hit, intersects, isVisible, paint, repaint, repaint, setInteractor, setParent, setToolTipText, setUserObject, setVisible, translate |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private java.awt.geom.Rectangle2D _bounds
| Constructor Detail |
|---|
public FigureTutorial.CustomRectangle(double x,
double y,
double width,
double height)
x - a doubley - a doublewidth - a doubleheight - a double| Method Detail |
|---|
public java.awt.geom.Rectangle2D getBounds()
getBounds in interface FiguregetBounds in class AbstractFigurepublic java.awt.Shape getShape()
getShape in interface FiguregetShape in class AbstractFigurepublic void paint(java.awt.Graphics2D g)
paint in interface VisibleComponentpaint in class AbstractFigurepublic void transform(java.awt.geom.AffineTransform at)
transform in interface Figuretransform in class AbstractFigure
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||