@Test public void drawBottomRightText1() throws Exception { if (!"Windows 7".equals(System.getProperty("os.name"))) { return; } Java2DStringUtilities.drawString(graphics, BOTTOM_RIGHT, x, y, "ABCD"); ImageAssert.compareImages("textUtilities.5", image); }
public static void drawString(Graphics2D g, Alignment alignment, int x, int y, String text) { Rectangle2D stringBounds = g.getFontMetrics().getStringBounds(text, g); g.drawString(text, alignment.stringRightSide(stringBounds, x), alignment.stringBaseline(stringBounds, y)); }
Java2DStringUtilities { public static void drawString(Graphics2D g, Alignment alignment, int x, int y, String text) { Rectangle2D stringBounds = g.getFontMetrics().getStringBounds(text, g); g.drawString(text, alignment.stringRightSide(stringBounds, x), alignment.stringBaseline(stringBounds, y)); } }
Java2DStringUtilities { public static void drawString(Graphics2D g, Alignment alignment, int x, int y, String text) { Rectangle2D stringBounds = g.getFontMetrics().getStringBounds(text, g); g.drawString(text, alignment.stringRightSide(stringBounds, x), alignment.stringBaseline(stringBounds, y)); }  }
Java2DStringUtilities { public static void drawString(Graphics2D g, Alignment alignment, int x, int y, String text) { Rectangle2D stringBounds = g.getFontMetrics().getStringBounds(text, g); g.drawString(text, alignment.stringRightSide(stringBounds, x), alignment.stringBaseline(stringBounds, y)); }  static void drawString(Graphics2D g, Alignment alignment, int x, int y, String text); }
Java2DStringUtilities { public static void drawString(Graphics2D g, Alignment alignment, int x, int y, String text) { Rectangle2D stringBounds = g.getFontMetrics().getStringBounds(text, g); g.drawString(text, alignment.stringRightSide(stringBounds, x), alignment.stringBaseline(stringBounds, y)); }  static void drawString(Graphics2D g, Alignment alignment, int x, int y, String text);  }