public class ImageLabel extends LabelFigure implements CanvasFigure
Modifier and Type | Field and Description |
---|---|
protected Object |
clientData
An arbitrary object to store with the figure for later reference
|
protected Composite |
composite
Make sure composites from other figures are not used here
|
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 |
---|
ImageLabel(String text,
Point2D.Double pos,
Paint fill,
Font font,
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.
|
Point2D |
getAnchorPoint()
Get the location at which the anchor is currently located.
|
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 |
isSelected()
Return true if the figure is selected.
|
void |
paint(Graphics2D g)
Paint the label.
|
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 with by the given distance.
|
autoAnchor, getAnchor, getBounds, getComposite, getFillPaint, getFont, getOrigin, getPadding, getShape, getString, setAnchor, setComposite, setFillPaint, setFont, setPadding, setString, transform, translateTo, translateTo
contains, getInteractor, getLayer, getParent, getToolTipText, getTransformContext, getUserObject, hit, intersects, isVisible, paint, repaint, repaint, setInteractor, setParent, setToolTipText, setUserObject
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getBounds, isVisible
protected Object clientData
protected CanvasFigureListenerManager listenerManager
protected LinkedList slaves
protected Composite composite
public ImageLabel(String text, Point2D.Double pos, Paint fill, Font font, Interactor interactor)
text
- the text of the label to drawpos
- the label positionfill
- the paint to use to draw the textfont
- the font to use for the labelinteractor
- 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 isSelected()
isSelected
in interface CanvasFigure
public void paint(Graphics2D g)
paint
in interface VisibleComponent
paint
in class LabelFigure
public void setVisible(boolean flag)
setVisible
in interface VisibleComponent
setVisible
in interface CanvasFigure
setVisible
in class AbstractFigure
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 AbstractFigure
public Point2D getAnchorPoint()
getAnchorPoint
in class LabelFigure
Copyright © 2023 Central Laboratory of the Research Councils. All Rights Reserved.