public class PaintedString extends Object implements PaintedObject
A utility class that paints a string. This is a low-level class which is designed to simplify the construction of drawn graphics. It contains enough font and painting information to be useful in many cases where fonts are needed for labels and so on in graphic diagrams.
Constructor and Description |
---|
PaintedString()
Construct an empty label figure.
|
PaintedString(String s)
Construct a label figure displaying the
given string, using the default font.
|
PaintedString(String s,
Font f)
Construct a label figure displaying the
given string in the given font.
|
PaintedString(String s,
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 |
---|---|
Rectangle2D |
getBounds()
Get the bounds of this string
|
Paint |
getFillPaint()
Get the fill paint for this label.
|
Font |
getFont()
Get the font that this label is drawn in.
|
String |
getFontName()
Get the font name.
|
Shape |
getShape()
Get the shape of this label figure.
|
int |
getSize()
Get the font size.
|
String |
getString()
Get the string of this label.
|
int |
getStyle()
Get the font style.
|
void |
paint(Graphics2D g)
Paint the label.
|
void |
setFillPaint(Paint p)
Set the fill paint that this shape
is drawn with.
|
void |
setFont(Font f)
Set the font.
|
void |
setFontName(String s)
Set the font family by name.
|
void |
setSize(int size)
Set the font size.
|
void |
setString(String s)
Set the string.
|
void |
setStyle(int style)
Set the font style.
|
void |
setTransform(AffineTransform at)
Change the transform of this label.
|
void |
transform(AffineTransform at)
Transform the label with the given transform.
|
void |
translate(double x,
double y)
Translate the label the given distance.
|
public PaintedString()
public PaintedString(String s)
public PaintedString(String s, Font f)
public Rectangle2D getBounds()
getBounds
in interface PaintedObject
public Font getFont()
public Paint getFillPaint()
public String getFontName()
public int getStyle()
public int getSize()
public Shape getShape()
public String getString()
public void paint(Graphics2D g)
paint
in interface PaintedObject
public void setFillPaint(Paint p)
public void setFont(Font f)
public void setFontName(String s)
public void setStyle(int style)
public void setSize(int size)
public void setString(String s)
public void setTransform(AffineTransform at)
public void transform(AffineTransform at)
public void translate(double x, double y)
Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.