public static int getStringWidth(String text, Graphics g, FontMetrics metrics) {
    return metrics.getStringBounds(text, g).getBounds().width;
  }
public static int getStringWidth(String text, Graphics g, FontMetrics metrics)