public class LabelWrapper extends AbstractFigure
Note that this class is intended for use in simple applications where a simple label is attached to something. For more complex applications, such as attaching multiple labels, you will need to implement your own class.
Constructor and Description |
---|
LabelWrapper(Figure f,
java.lang.String label)
Construct a new figure with the given child figure and
the given string.
|
Modifier and Type | Method and Description |
---|---|
java.awt.geom.Rectangle2D |
getBounds()
Get the bounds of this figure.
|
Figure |
getChild()
Get the child figure
|
LabelFigure |
getLabel()
Get the label.
|
java.awt.Shape |
getShape()
Get the shape of this figure.
|
boolean |
hit(java.awt.geom.Rectangle2D r)
We are hit if either the child or the figure is hit.
|
void |
paint(java.awt.Graphics2D g)
Paint this figure
|
void |
setAnchor(int anchor)
Set the anchor of the label.
|
void |
transform(java.awt.geom.AffineTransform at)
Transform the figure with the supplied transform.
|
contains, getInteractor, getLayer, getOrigin, getParent, getToolTipText, getTransformContext, getUserObject, intersects, isVisible, paint, repaint, repaint, setInteractor, setParent, setToolTipText, setUserObject, setVisible, translate
public LabelWrapper(Figure f, java.lang.String label)
public java.awt.geom.Rectangle2D getBounds()
getBounds
in interface Figure
getBounds
in class AbstractFigure
public Figure getChild()
public LabelFigure getLabel()
public java.awt.Shape getShape()
getShape
in interface Figure
getShape
in class AbstractFigure
public boolean hit(java.awt.geom.Rectangle2D r)
hit
in interface Figure
hit
in class AbstractFigure
r
- The rectangle to be checked.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 setAnchor(int anchor)
public void transform(java.awt.geom.AffineTransform at)
transform
in interface Figure
transform
in class AbstractFigure
at
- The transform to be used.