public class Java2DStringUtilities extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Java2DStringUtilities.Alignment
How a string will be drawn, in relation to the given center pixel.
|
| Constructor and Description |
|---|
Java2DStringUtilities() |
| Modifier and Type | Method and Description |
|---|---|
static void |
drawString(Graphics2D g,
Java2DStringUtilities.Alignment alignment,
int x,
int y,
String text)
Draws a string using the given alignment.
|
public static void drawString(Graphics2D g, Java2DStringUtilities.Alignment alignment, int x, int y, String text)
g - Graphics2D element, calls drawString.alignment - Possible values: TOP_RIGHT, TOP, TOP_LEFT, RIGHT, CENTER, LEFT, BOTTOM_RIGHT, BOTTOM, BOTTOM_LEFT;x - corresponds to different positions based on the alignment,
but generally the x-coordinate of the pixel position where the graphics component will begin drawing the string.y - corresponds to different positions based on the alignment,
but generally the y-coordinate of the pixel position where the graphics component will begin drawing the string.text - string to be drawn.Copyright © 2015. All rights reserved.