g.setColor(Color.WHITE);
Color savedColor = g.getColor(); Shape savedClip = g.getClip(); FontMetrics fm = g.getFontMetrics(progressBar.getFont()); int full = getAmountFull(b, width, height); String str = progressBar.getString();
  protected void paintString(Graphics g, int x, int y, int width, int height,                             int amountFull, Insets b)  {    // We want to place in the exact center of the bar.    Point placement = getStringPlacement(g, progressBar.getString(),                                         x + b.left, y + b.top,                                         width - b.left - b.right,                                         height - b.top - b.bottom);    Color saved = g.getColor();    // FIXME: The Color of the text should use selectionForeground and selectionBackground    // but that can't be done right now, so we'll use white in the mean time.    g.setColor(Color.WHITE);    FontMetrics fm = g.getFontMetrics(progressBar.getFont());    g.drawString(progressBar.getString(), placement.x,                 placement.y + fm.getAscent());    g.setColor(saved);  }