/* StringUtility.java History: 23 Sep 2005 Created. */ import java.awt.*; public class StringUtility { public static void drawCenteredString(String str, Graphics g, Component c) { FontMetrics fm = g.getFontMetrics(); int str_width = fm.stringWidth(str); int str_height = fm.getAscent() + fm.getDescent(); g.drawString(str, (c.getWidth() - str_width)/2, (c.getHeight() - str_height)/2 + fm.getAscent()); } }