Package host.anzo.commons.graphics.text
Class TextRenderer
java.lang.Object
host.anzo.commons.graphics.text.TextRenderer
A class which provides static methods for rendering text using alignment.
-
Method Summary
Modifier and TypeMethodDescriptionstatic RectangleDraws a string onto aGraphicshandle, using aFont,Colorand target bounds to calculate the location and automatic wrapping of text.static RectangledrawString(Graphics g, String text, Font font, Color color, Rectangle bounds, TextAlignment align) Draws a string onto aGraphicshandle, using aFont,Colorand target bounds to calculate the location and automatic wrapping of text.static RectangledrawString(Graphics g, String text, Font font, Color color, Rectangle bounds, TextAlignment align, int format) Draws a string onto aGraphicshandle, using aFont,Colorand target bounds to calculate the location and automatic wrapping of text.
-
Method Details
-
drawString
public static Rectangle drawString(Graphics g, String text, Font font, Color color, Rectangle bounds) Draws a string onto aGraphicshandle, using aFont,Colorand target bounds to calculate the location and automatic wrapping of text. The align property determines where the text will be positioned.- Parameters:
g- AGraphicshandle which is the target of the draw operationtext- AStringcontaining the text to drawfont- TheFontto use when drawing the textcolor- TheColorto use when drawing the textbounds- ARectanglerepresenting the bounds of the text- Returns:
- A
Rectanglerepresenting the bounds consumed by the text
-
drawString
public static Rectangle drawString(Graphics g, String text, Font font, Color color, Rectangle bounds, TextAlignment align) Draws a string onto aGraphicshandle, using aFont,Colorand target bounds to calculate the location and automatic wrapping of text. The align property determines where the text will be positioned.- Parameters:
g- AGraphicshandle which is the target of the draw operationtext- AStringcontaining the text to drawfont- TheFontto use when drawing the textcolor- TheColorto use when drawing the textbounds- ARectanglerepresenting the bounds of the textalign- ATextAlignmentvalue representing the location to draw the text, relative to the bounds- Returns:
- A
Rectanglerepresenting the bounds consumed by the text
-
drawString
public static Rectangle drawString(Graphics g, String text, Font font, Color color, Rectangle bounds, TextAlignment align, int format) Draws a string onto aGraphicshandle, using aFont,Colorand target bounds to calculate the location and automatic wrapping of text. The align property determines where the text will be positioned.- Parameters:
g- AGraphicshandle which is the target of the draw operationtext- AStringcontaining the text to drawfont- TheFontto use when drawing the textcolor- TheColorto use when drawing the textbounds- ARectanglerepresenting the bounds of the textalign- ATextAlignmentvalue representing the location to draw the text, relative to the boundsformat- Additional formatting flags to use when drawing (seeTextFormatclass)- Returns:
- A
Rectanglerepresenting the bounds consumed by the text
-