|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
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 simple open and closed shapes. For more complex Figures, use the VectorFigure class.
Field Summary | |
---|---|
private boolean |
_centered
Indicator of whether this figure should be centered on its origin. |
private java.awt.Composite |
_composite
The color compositing operator. |
private float[] |
_dashArray
The dash array if setDashArray is called. |
private java.awt.Paint |
_fillPaint
The paint for the fill. |
private float |
_lineWidth
The width of the line. |
private java.awt.Shape |
_shape
The shape of this figure. |
private java.awt.Stroke |
_stroke
The stroke. |
private java.awt.Paint |
_strokePaint
The stroke paint. |
private java.awt.geom.AffineTransform |
_transform
The transform. |
Constructor Summary | |
---|---|
BasicFigure(java.awt.Shape shape)
Create a new figure with the given shape. |
|
BasicFigure(java.awt.Shape shape,
float lineWidth)
Create a new figure with the given shape and outline width. |
|
BasicFigure(java.awt.Shape shape,
int lineWidth)
Deprecated. Use the float constructor instead. |
|
BasicFigure(java.awt.Shape shape,
java.awt.Paint fill)
Create a new figure with the given paint pattern. |
|
BasicFigure(java.awt.Shape shape,
java.awt.Paint fill,
float lineWidth)
Create a new figure with the given paint pattern and line width. |
Method Summary | |
---|---|
java.awt.geom.Rectangle2D |
getBounds()
Get the bounding box of this figure. |
java.awt.Composite |
getComposite()
Get the compositing operator |
float[] |
getDashArray()
Get the dash array. |
java.awt.Paint |
getFillPaint()
Get the fill paint |
float |
getLineWidth()
Get the line width. |
java.awt.geom.Point2D |
getOrigin()
Return the origin of the figure in the enclosing transform context. |
java.awt.Shape |
getShape()
Get the shape of this figure. |
java.awt.Paint |
getStrokePaint()
Get the paint used to stroke this figure |
boolean |
hit(java.awt.geom.Rectangle2D r)
Test if this figure intersects the given rectangle. |
boolean |
isCentered()
Return whether the figure should be centered on its origin. |
void |
paint(java.awt.Graphics2D g)
Paint the figure. |
void |
setCentered(boolean centered)
Specify whether the figure should be centered on its origin. |
void |
setComposite(java.awt.AlphaComposite c)
Set the compositing operation for this figure. |
void |
setDashArray(float[] dashArray)
Set the dash array of the stroke. |
void |
setFillPaint(java.awt.Paint p)
Set the fill paint. |
void |
setLineWidth(float lineWidth)
Set the line width. |
void |
setPrototypeShape(java.awt.Shape s)
Change the shape of the figure without modifying its other properties, such as its position. |
void |
setShape(java.awt.Shape s)
Set the shape of this figure. |
void |
setStroke(java.awt.Stroke s)
Set the stroke |
void |
setStrokePaint(java.awt.Paint p)
Set the stroke paint |
void |
transform(java.awt.geom.AffineTransform at)
Transform the figure with the supplied transform. |
Methods inherited from class diva.canvas.AbstractFigure |
---|
contains, getInteractor, getLayer, getParent, getToolTipText, getTransformContext, getUserObject, 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 |
Methods inherited from interface diva.canvas.Figure |
---|
contains, getInteractor, getLayer, getParent, getToolTipText, intersects, setInteractor, setParent, setToolTipText, translate |
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 |
Field Detail |
---|
private boolean _centered
private float[] _dashArray
private java.awt.Composite _composite
private float _lineWidth
private java.awt.Shape _shape
private java.awt.Paint _fillPaint
private java.awt.Stroke _stroke
private java.awt.Paint _strokePaint
private java.awt.geom.AffineTransform _transform
Constructor Detail |
---|
public BasicFigure(java.awt.Shape shape)
public BasicFigure(java.awt.Shape shape, int lineWidth)
public BasicFigure(java.awt.Shape shape, float lineWidth)
public BasicFigure(java.awt.Shape shape, java.awt.Paint fill)
public BasicFigure(java.awt.Shape shape, java.awt.Paint fill, float lineWidth)
Method Detail |
---|
public java.awt.geom.Rectangle2D getBounds()
getBounds
in interface Figure
getBounds
in class AbstractFigure
public java.awt.Composite getComposite()
public float[] getDashArray()
public java.awt.Paint getFillPaint()
public float getLineWidth()
public java.awt.geom.Point2D getOrigin()
getOrigin
in interface Figure
getOrigin
in class AbstractFigure
AbstractFigure.getBounds()
public java.awt.Shape getShape()
getShape
in interface Figure
getShape
in class AbstractFigure
public java.awt.Paint getStrokePaint()
public boolean hit(java.awt.geom.Rectangle2D r)
hit
in interface Figure
hit
in class AbstractFigure
public boolean isCentered()
getOrigin()
,
setCentered(boolean)
public void paint(java.awt.Graphics2D g)
paint
in interface VisibleComponent
paint
in class AbstractFigure
public void setCentered(boolean centered)
centered
- False to make the origin of the figure, as
returned by getOrigin(), be the upper left corner.getOrigin()
public void setComposite(java.awt.AlphaComposite c)
public void setDashArray(float[] dashArray)
public void setFillPaint(java.awt.Paint p)
public void setLineWidth(float lineWidth)
public void setPrototypeShape(java.awt.Shape s)
public void setShape(java.awt.Shape s)
setShape
in interface ShapedFigure
public void setStrokePaint(java.awt.Paint p)
public void setStroke(java.awt.Stroke s)
public void transform(java.awt.geom.AffineTransform at)
transform
in interface Figure
transform
in class AbstractFigure
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |