I know this question has been answered before, but it's just not working for me. I followed the instructions from here: How to change JProgressBar color?
import javax.swing.*;
import java.awt.*;
public class ProgressBarTest extends JFrame {
public static void main(String args[]) {
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
UIManager.put("ProgressBar.background", Color.orange);
UIManager.put("ProgressBar.foreground", Color.black);
UIManager.put("ProgressBar.selectionBackground", Color.red);
UIManager.put("ProgressBar.selectionForeground", Color.green);
JProgressBar progressBar = new JProgressBar(0,100);
progressBar.setValue(50);
f.add(progressBar, BorderLayout.PAGE_END);
f.pack();
f.setLocationRelativeTo(null);
f.setVisible(true);
}
}
All I am getting is the same old colors.
I'm using Mac OS X 10.7.3 and Java 1.6. I tried the CrossPlatformLookAndFeel
and it works with the new colors. However I want this in the default look and feel. How can I do this?