public class BasicFigure extends AbstractFigure implements ShapedFigure
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
double |
getRotation()
Get the angle of rotation of the figure.
|
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 |
setRotation(double angle)
Set the rotation angle of the figure to the specified angle in radians.
|
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.
|
contains, getInteractor, getLayer, getParent, getToolTipText, getTransformContext, getUserObject, intersects, isVisible, paint, repaint, repaint, setInteractor, setParent, setToolTipText, setUserObject, setVisible, translate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
contains, getInteractor, getLayer, getParent, getToolTipText, intersects, setInteractor, setParent, setToolTipText, translate
isVisible, paint, setVisible
getTransformContext, repaint, repaint
getUserObject, setUserObject
public BasicFigure(java.awt.Shape shape)
@Deprecated 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)
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 double getRotation()
setRotation(double)
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
r
- The rectangle to be checked.public boolean isCentered()
getOrigin()
,
setCentered(boolean)
public void paint(java.awt.Graphics2D g)
paint
in interface VisibleComponent
paint
in class AbstractFigure
g
- The 2D graphics object that this object
it to be painted upon.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 setRotation(double angle)
angle
- The angle of rotation.getRotation()
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
at
- The transform to be used.