public class ImageFigure extends BasicFigure implements CanvasFigure
Modifier and Type | Field and Description |
---|---|
protected Object |
clientData
An arbitrary object to store with the figure for later reference
|
protected CanvasFigureListenerManager |
listenerManager
Manages a list of listeners for figure events
|
protected LinkedList |
slaves
Optional linked list of slave figures, which should be moved with this figure.
|
DESELECTED, MOVED, RESIZED, SELECTED
Constructor and Description |
---|
ImageFigure(Shape shape,
Paint fill,
Paint outline,
float lineWidth,
Interactor interactor)
Create an image figure with the given shape, fill, outline and line width.
|
Modifier and Type | Method and Description |
---|---|
void |
addCanvasFigureListener(CanvasFigureListener listener)
Add a listener for events on the canvas figure
|
void |
addSlave(CanvasFigure fig)
Add a slave figure.
|
void |
fireCanvasFigureEvent(int eventType)
Fire an event on the canvas figure.
|
Rectangle2D |
getBoundsWithoutLabel()
Return the bounds of this figure, ignoring the label, if there is one.
|
Object |
getClientData()
Return the client data object, or null if none was set
|
boolean |
hit(Rectangle2D r)
Test if this shape is hit by the given rectangle
(Override parent class version, since the 25-sep-00 version only hits the outline).
|
boolean |
isSelected()
Return true if the figure is selected.
|
void |
removeCanvasFigureListener(CanvasFigureListener listener)
Remove a listener for events on the canvas figure
|
void |
setClientData(Object o)
Store an arbitrary object with the figure for later reference
|
void |
setVisible(boolean flag)
Set the visibility flag of this object.
|
void |
translate(double x,
double y)
Translate the figure by the given distance.
|
getBounds, getComposite, getDashArray, getFillPaint, getLineWidth, getShape, getStrokePaint, paint, setComposite, setDashArray, setFillPaint, setLineWidth, setShape, setStroke, setStrokePaint, transform
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
getBounds, isVisible
contains, getInteractor, getLayer, getOrigin, getParent, getToolTipText, intersects, setInteractor, setParent, setToolTipText
isVisible, paint
getTransformContext, repaint, repaint
getUserObject, setUserObject
protected Object clientData
protected CanvasFigureListenerManager listenerManager
protected LinkedList slaves
public ImageFigure(Shape shape, Paint fill, Paint outline, float lineWidth, Interactor interactor)
shape
- the shape to drawfill
- the paint to use to fill the shapeoutline
- the paint to use for the outlinelineWidth
- the width of the shape lines in pixelsinteractor
- determines the behavior of the figure (may be null)public void setClientData(Object o)
setClientData
in interface CanvasFigure
public Object getClientData()
getClientData
in interface CanvasFigure
public Rectangle2D getBoundsWithoutLabel()
getBoundsWithoutLabel
in interface CanvasFigure
public boolean hit(Rectangle2D r)
hit
in interface Figure
hit
in class BasicFigure
public void setVisible(boolean flag)
setVisible
in interface VisibleComponent
setVisible
in interface CanvasFigure
setVisible
in class AbstractFigure
public boolean isSelected()
isSelected
in interface CanvasFigure
public void addCanvasFigureListener(CanvasFigureListener listener)
addCanvasFigureListener
in interface CanvasFigure
public void removeCanvasFigureListener(CanvasFigureListener listener)
removeCanvasFigureListener
in interface CanvasFigure
public void fireCanvasFigureEvent(int eventType)
fireCanvasFigureEvent
in interface CanvasFigure
eventType
- one of the CanvasFigure constants: SELECTED, DESELECTED, RESIZED, MOVEDpublic void addSlave(CanvasFigure fig)
addSlave
in interface CanvasFigure
public void translate(double x, double y)
translate
in interface Figure
translate
in class BasicFigure
Copyright © 2023 Central Laboratory of the Research Councils. All Rights Reserved.