public class LabelFigure extends AbstractFigure
Constructor and Description |
---|
LabelFigure()
Construct an empty label figure.
|
LabelFigure(java.lang.String s)
Construct a label figure displaying the
given string, using the default font.
|
LabelFigure(java.lang.String s,
java.awt.Font f)
Construct a label figure displaying the
given string in the given font.
|
LabelFigure(java.lang.String s,
java.awt.Font font,
double padding,
int anchor)
Construct a label figure displaying the
given string in the given font, with the given padding and anchor.
|
LabelFigure(java.lang.String s,
java.awt.Font font,
double padding,
int anchor,
java.awt.Color color)
Construct a label figure displaying the
given string in the given font, with the given padding and anchor,
and the given color.
|
LabelFigure(java.lang.String s,
java.lang.String face,
int style,
int size)
Construct a label figure displaying the
given string in the given face, style, and size.
|
Modifier and Type | Method and Description |
---|---|
void |
autoAnchor(java.awt.Shape s)
Choose an anchor point so as not to intersect a given
figure.
|
int |
getAnchor()
Get the point at which this figure is "anchored."
|
java.awt.geom.Point2D |
getAnchorPoint()
Get the location at which the anchor is currently located.
|
java.awt.geom.Rectangle2D |
getBounds()
Get the bounds of this string
|
java.awt.Paint |
getFillPaint()
Get the fill paint for this label.
|
java.awt.Font |
getFont()
Get the font that this label is drawn in.
|
java.awt.geom.Point2D |
getOrigin()
Return the origin, which is the anchor point.
|
double |
getPadding()
Get the padding around the text.
|
java.awt.Shape |
getShape()
Get the shape of this label figure.
|
java.lang.String |
getString()
Get the string.
|
void |
paint(java.awt.Graphics2D g)
Paint the figure.
|
void |
setAnchor(int anchor)
Set the point at which this figure is "anchored."
|
void |
setFillPaint(java.awt.Paint p)
Set the fill paint that this shape
is drawn with.
|
void |
setFont(java.awt.Font f)
Set the font.
|
void |
setPadding(double padding)
Set the "padding" around the text.
|
void |
setString(java.lang.String s)
Set the string.
|
void |
transform(java.awt.geom.AffineTransform at)
Transform the label with the given transform.
|
void |
translateTo(double x,
double y)
Translate the label so that the current anchor is located
at the given point.
|
void |
translateTo(java.awt.geom.Point2D pt)
Translate the label so that the current anchor is located
at the given point.
|
contains, getInteractor, getLayer, getParent, getToolTipText, getTransformContext, getUserObject, hit, intersects, isVisible, paint, repaint, repaint, setInteractor, setParent, setToolTipText, setUserObject, setVisible, translate
public LabelFigure()
public LabelFigure(java.lang.String s)
public LabelFigure(java.lang.String s, java.lang.String face, int style, int size)
public LabelFigure(java.lang.String s, java.awt.Font f)
public LabelFigure(java.lang.String s, java.awt.Font font, double padding, int anchor)
public LabelFigure(java.lang.String s, java.awt.Font font, double padding, int anchor, java.awt.Color color)
public void autoAnchor(java.awt.Shape s)
public int getAnchor()
public java.awt.geom.Point2D getAnchorPoint()
public java.awt.geom.Rectangle2D getBounds()
getBounds
in interface Figure
getBounds
in class AbstractFigure
public java.awt.Font getFont()
public java.awt.Paint getFillPaint()
public java.awt.geom.Point2D getOrigin()
getOrigin
in interface Figure
getOrigin
in class AbstractFigure
AbstractFigure.getBounds()
public double getPadding()
public java.awt.Shape getShape()
getShape
in interface Figure
getShape
in class AbstractFigure
public java.lang.String getString()
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 setFillPaint(java.awt.Paint p)
public void setFont(java.awt.Font f)
public void setPadding(double padding)
public void setString(java.lang.String s)
public void transform(java.awt.geom.AffineTransform at)
transform
in interface Figure
transform
in class AbstractFigure
at
- The transform to be used.public void translateTo(double x, double y)
public void translateTo(java.awt.geom.Point2D pt)