|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdiva.canvas.AbstractFigure
diva.canvas.toolbox.LabelWrapper
public class LabelWrapper
A LabelWrapper is a figure that attaches a label to some other figure. The location at which the label is attached can (in this class) be set to the center or to any of the four edges or corners of the bounding box. (Maybe later we'll figure out a way to have the label locate at a site.) In addition, the anchor and padding attributes of the figure itself can be used to adjust the label location relative to the anchoring point on the main figure.
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.
Field Summary | |
---|---|
private int |
_anchor
The label anchor |
private Figure |
_child
The child |
private LabelFigure |
_label
The label |
Constructor Summary | |
---|---|
LabelWrapper(Figure f,
java.lang.String label)
Construct a new figure with the given child figure and the given string. |
Method Summary | |
---|---|
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. |
Methods inherited from class diva.canvas.AbstractFigure |
---|
contains, getInteractor, getLayer, getOrigin, getParent, getToolTipText, getTransformContext, getUserObject, intersects, isVisible, paint, repaint, repaint, setInteractor, setParent, setToolTipText, setUserObject, setVisible, translate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private Figure _child
private LabelFigure _label
private int _anchor
Constructor Detail |
---|
public LabelWrapper(Figure f, java.lang.String label)
Method Detail |
---|
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
public void paint(java.awt.Graphics2D g)
paint
in interface VisibleComponent
paint
in class AbstractFigure
public void setAnchor(int anchor)
public void transform(java.awt.geom.AffineTransform at)
transform
in interface Figure
transform
in class AbstractFigure
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |