UIDefaults defaults = UIManager.getLookAndFeelDefaults();  progressBar.setFont(defaults.getFont("ProgressBar.font")); progressBar.setForeground(defaults.getColor("ProgressBar.foreground")); progressBar.setBackground(defaults.getColor("ProgressBar.background")); progressBar.setBorder(defaults.getBorder("ProgressBar.border"));
LookAndFeel.installColorsAndFont(progressBar, "ProgressBar.background", "ProgressBar.foreground", "ProgressBar.font"); LookAndFeel.installBorder(progressBar, "ProgressBar.border");
  protected void installDefaults()  {    UIDefaults defaults = UIManager.getLookAndFeelDefaults();    progressBar.setFont(defaults.getFont("ProgressBar.font"));    progressBar.setForeground(defaults.getColor("ProgressBar.foreground"));    progressBar.setBackground(defaults.getColor("ProgressBar.background"));    progressBar.setBorder(defaults.getBorder("ProgressBar.border"));    progressBar.setOpaque(true);    selectionForeground = defaults.getColor("ProgressBar.selectionForeground");    selectionBackground = defaults.getColor("ProgressBar.selectionBackground");    cellLength = defaults.getInt("ProgressBar.cellLength");    cellSpacing = defaults.getInt("ProgressBar.cellSpacing");    int repaintInterval = defaults.getInt("ProgressBar.repaintInterval");    int cycleTime = defaults.getInt("ProgressBar.cycleTime");    if (cycleTime % repaintInterval != 0        && (cycleTime / repaintInterval) % 2 != 0)      {	int div = (cycleTime / repaintInterval) + 2;	div /= 2;	div *= 2;	cycleTime = div * repaintInterval;      }    setAnimationIndex(0);    numFrames = cycleTime / repaintInterval;    animationTimer.setDelay(repaintInterval);  }