I am trying to set the foreground colour of progress bars to green, and the background colour to yellow, I am doing the following
JProgressBar pb = new JProgressBar(0, 100);
pb.setBackground(Color.YELLOW);
pb.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
pb.setForeground(Color.GREEN.darker());
pb.setOpaque(true);
pb.setStringPainted(true);
pb.setPreferredSize(new Dimension(pb.getPreferredSize().width, 16));
I expected the bar to be yellow, instead the colour behind the bar is yellow. See below (I have tried the UIManager approach as well)
EDIT: It looks like it's the Windows L&F that's causing the issue