|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdiva.canvas.AbstractFigure
diva.canvas.toolbox.BasicFigure
public class BasicFigure
A BasicFigure is one that contains a single instance of Shape. The figure can have a fill with optional compositing (for translucency), and a stroke with a different fill. With this class, simple objects can be created on-the-fly simply by passing an instance of java.awt.Shape to the constructor. This class is mainly intended for use for closed shapes -- for open shapes, use the PathFigure class. For more complex Figures, use the VectorFigure class.
Constructor Summary | |
---|---|
BasicFigure(Shape shape)
Create a new figure with the given shape. |
|
BasicFigure(Shape shape,
float lineWidth)
Create a new figure with the given shape and outline width. |
|
BasicFigure(Shape shape,
int lineWidth)
Deprecated. |
|
BasicFigure(Shape shape,
Paint fill)
Create a new figure with the given paint pattern. |
|
BasicFigure(Shape shape,
Paint fill,
float lineWidth)
Create a new figure with the given paint pattern and line width. |
Method Summary | |
---|---|
Rectangle2D |
getBounds()
Get the bounding box of this figure. |
Composite |
getComposite()
Get the compositing operator |
float[] |
getDashArray()
Get the dash array. |
Paint |
getFillPaint()
Get the fill paint |
float |
getLineWidth()
Get the line width. |
Shape |
getShape()
Get the shape of this figure. |
Paint |
getStrokePaint()
Get the paint used to stroke this figure |
boolean |
hit(Rectangle2D r)
Test if this figure intersects the given rectangle. |
void |
paint(Graphics2D g)
Paint the figure. |
void |
setComposite(AlphaComposite c)
Set the compositing operation for this figure. |
void |
setDashArray(float[] dashArray)
Set the dash array of the stroke. |
void |
setFillPaint(Paint p)
Set the fill paint. |
void |
setLineWidth(float lineWidth)
Set the line width. |
void |
setShape(Shape s)
Set the shape of this figure. |
void |
setStroke(Stroke s)
Set the stroke |
void |
setStrokePaint(Paint p)
Set the stroke paint |
void |
transform(AffineTransform at)
Transform the figure with the supplied transform. |
void |
translate(double x,
double y)
Translate the figure with by the given distance. |
Methods inherited from class diva.canvas.AbstractFigure |
---|
contains, getInteractor, getLayer, getOrigin, getParent, getToolTipText, getTransformContext, getUserObject, intersects, isVisible, paint, repaint, repaint, setInteractor, setParent, setToolTipText, setUserObject, setVisible |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface diva.canvas.Figure |
---|
contains, getInteractor, getLayer, getOrigin, getParent, getToolTipText, intersects, setInteractor, setParent, setToolTipText |
Methods inherited from interface diva.canvas.VisibleComponent |
---|
isVisible, paint, setVisible |
Methods inherited from interface diva.canvas.CanvasComponent |
---|
getTransformContext, repaint, repaint |
Methods inherited from interface diva.util.UserObjectContainer |
---|
getUserObject, setUserObject |
Constructor Detail |
---|
public BasicFigure(Shape shape)
public BasicFigure(Shape shape, int lineWidth)
public BasicFigure(Shape shape, float lineWidth)
public BasicFigure(Shape shape, Paint fill)
public BasicFigure(Shape shape, Paint fill, float lineWidth)
Method Detail |
---|
public Rectangle2D getBounds()
getBounds
in interface Figure
getBounds
in class AbstractFigure
public Composite getComposite()
public float[] getDashArray()
public float getLineWidth()
public Paint getFillPaint()
public Shape getShape()
getShape
in interface Figure
getShape
in class AbstractFigure
public Paint getStrokePaint()
public boolean hit(Rectangle2D r)
hit
in interface Figure
hit
in class AbstractFigure
public void paint(Graphics2D g)
paint
in interface VisibleComponent
paint
in class AbstractFigure
public void setComposite(AlphaComposite c)
public void setDashArray(float[] dashArray)
public void setFillPaint(Paint p)
public void setLineWidth(float lineWidth)
public void setShape(Shape s)
setShape
in interface ShapedFigure
public void setStrokePaint(Paint p)
public void setStroke(Stroke s)
public void transform(AffineTransform at)
transform
in interface Figure
transform
in class AbstractFigure
public void translate(double x, double y)
translate
in interface Figure
translate
in class AbstractFigure
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |