1 I am trying to change the color of the progress bar but it stays orange here's the code:
test(){
UIManager.put("ProgressBar.background", Color.BLACK);
UIManager.put("ProgressBar.foreground", Color.RED);
UIManager.put("ProgressBar.selectionBackground", Color.YELLOW);
UIManager.put("ProgressBar.selectionForeground", Color.BLUE);
bar = new JProgressBar();
bar.setBounds(20, 30,400 , 200);
bar.setString("Welcome...");
bar.setStringPainted(true);
this.add(bar);
I've tried .setbackground it also didnt work
the problem with your code might relate to the location which you called
UIManager. if you call it before object initialization it works correctly:result:

and if you call
UIManagerafter initialization the result will differ:result:
]2