public class DrawBasicFigure extends BasicFigure implements DrawFigure
All figures used on a Draw
that is using DrawActions
should be derived classes of this class, or implement the necessary
code to support the DrawFigure
interface. They should also
invoke fireChanged in their translate and transform methods (but
not if calling super) and respect the transformFreely state.
Draw
,
DrawFigure
Modifier and Type | Field and Description |
---|---|
protected EventListenerList |
listeners |
protected static boolean |
transformFreely
Hint that figures should ignore any transformation constraints.
|
Constructor and Description |
---|
DrawBasicFigure()
Default constructor.
|
DrawBasicFigure(Shape shape)
Create a new figure with the given shape.
|
DrawBasicFigure(Shape shape,
float lineWidth)
Create a new figure with the given shape and outline width.
|
DrawBasicFigure(Shape shape,
Paint fill)
Create a new figure with the given paint pattern.
|
DrawBasicFigure(Shape shape,
Paint fill,
float lineWidth)
Create a new figure with the given paint pattern and outline width.
|
DrawBasicFigure(Shape shape,
Paint fill,
Paint outline,
float lineWidth)
Create a new figure with the given fill and outline paints
and outline width.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(FigureListener l)
Registers a listener for to be informed when figure changes
occur.
|
protected void |
fireChanged()
Send a FigureChangedEvent object specifying that this figure
has changed.
|
protected void |
fireCreated()
Send a FigureChangedEvent object specifying that this figure
has created to all listeners.
|
protected void |
fireRemoved()
Send a FigureChangedEvent object specifying that this figure
has been removed.
|
static boolean |
isTransformFreely()
Find out if this is an occasion when a figure should give up
any constraints and traneform freely.
|
void |
removeListener(FigureListener l)
Remove a listener.
|
void |
setTransformFreely(boolean state)
Enable the hint that a figure should allow itself to transform
freely, rather than obey any constraints (this is meant for
figures that could not otherwise redraw themselves to fit a
resized
Draw , given their normal constraints,
e.g. |
void |
setVisible(boolean flag)
Set the visibility flag of this figure.
|
void |
transform(AffineTransform at)
Transform the figure.
|
void |
translate(double x,
double y)
Translate the figure.
|
getBounds, getComposite, getDashArray, getFillPaint, getLineWidth, getShape, getStrokePaint, hit, paint, setComposite, setDashArray, setFillPaint, setLineWidth, setShape, setStroke, setStrokePaint
contains, getInteractor, getLayer, getOrigin, getParent, getToolTipText, getTransformContext, getUserObject, intersects, isVisible, paint, repaint, repaint, setInteractor, setParent, setToolTipText, setUserObject
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getComposite, getFillPaint, getLineWidth, getStrokePaint, setComposite, setFillPaint, setLineWidth, setShape, setStrokePaint
contains, getBounds, getInteractor, getLayer, getOrigin, getParent, getShape, getToolTipText, hit, intersects, setInteractor, setParent, setToolTipText
isVisible, paint, paint
getTransformContext, repaint, repaint
getUserObject, setUserObject
protected static boolean transformFreely
protected EventListenerList listeners
public DrawBasicFigure()
public DrawBasicFigure(Shape shape)
public DrawBasicFigure(Shape shape, float lineWidth)
public DrawBasicFigure(Shape shape, Paint fill)
public DrawBasicFigure(Shape shape, Paint fill, Paint outline, float lineWidth)
public void translate(double x, double y)
translate
in interface Figure
translate
in class BasicFigure
public void transform(AffineTransform at)
transform
in interface Figure
transform
in class BasicFigure
public void setVisible(boolean flag)
AbstractFigure
setVisible
in interface VisibleComponent
setVisible
in interface DrawFigure
setVisible
in class AbstractFigure
public void setTransformFreely(boolean state)
Draw
, given their normal constraints,
e.g. XRangeFigure).setTransformFreely
in interface DrawFigure
public static boolean isTransformFreely()
public void addListener(FigureListener l)
addListener
in interface DrawFigure
l
- the FigureListenerpublic void removeListener(FigureListener l)
removeListener
in interface DrawFigure
l
- the FigureListenerprotected void fireCreated()
protected void fireRemoved()
protected void fireChanged()
Copyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.