public class TextUtils extends java.lang.Object
Constructor and Description |
---|
TextUtils() |
Modifier and Type | Method and Description |
---|---|
static java.awt.geom.Rectangle2D |
calcAlignedStringBounds(java.lang.String text,
java.awt.Graphics2D g2,
float x,
float y,
org.jfree.ui.TextAnchor anchor)
Returns the bounds of an aligned string.
|
static java.awt.geom.Rectangle2D |
drawAlignedString(java.lang.String text,
java.awt.Graphics2D g2,
float x,
float y,
org.jfree.ui.TextAnchor anchor)
Draws a string such that the specified anchor point is aligned to the
given
(x, y) location, and returns a bounding rectangle
for the text. |
static java.awt.geom.Rectangle2D |
getTextBounds(java.lang.String text,
double x,
double y,
java.awt.FontMetrics fm)
Returns the bounds for the specified text when it is drawn with the
left-baseline aligned to the point
(x, y) . |
static java.awt.geom.Rectangle2D |
getTextBounds(java.lang.String text,
java.awt.FontMetrics fm)
Returns the bounds for the specified text.
|
public TextUtils()
public static java.awt.geom.Rectangle2D drawAlignedString(java.lang.String text, java.awt.Graphics2D g2, float x, float y, org.jfree.ui.TextAnchor anchor)
(x, y)
location, and returns a bounding rectangle
for the text.text
- the text.g2
- the graphics device.x
- the x coordinate (Java 2D).y
- the y coordinate (Java 2D).anchor
- the anchor location.public static java.awt.geom.Rectangle2D calcAlignedStringBounds(java.lang.String text, java.awt.Graphics2D g2, float x, float y, org.jfree.ui.TextAnchor anchor)
text
- the string (null
not permitted).g2
- the graphics target (null
not permitted).x
- the x-coordinate.y
- the y-coordinate.anchor
- the anchor point that will be aligned to
(x, y)
(null
not permitted).null
).public static java.awt.geom.Rectangle2D getTextBounds(java.lang.String text, java.awt.FontMetrics fm)
text
- the text (null
not permitted).fm
- the font metrics (null
not permitted).public static java.awt.geom.Rectangle2D getTextBounds(java.lang.String text, double x, double y, java.awt.FontMetrics fm)
(x, y)
.text
- the text (null
not permitted).x
- the x-coordinate.y
- the y-coordinate.fm
- the font metrics (null
not permitted).null
).