Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

One of the projects I've been working on recently had quite an extensive UI written (by me) using Swing. The Nimbus L&F was used throughout to make it look a bit more modern. Nimbus is a nice looking UI L&F, however the choice of some colours within its theme is a little odd.

One of the colours that I thought really didn't fit in with the rest was the progress bar orange, so I went about trying to see if I could change it.

This is what the default colours look like for a progress bar:

The above screenshot shows a normal progress bar as well as an indeterminate progress bar.

The Nimbus Defaults page lists all of the default colours, painters, icons, etc that Nimbus uses. The one that I had to change was the 'nimbusOrange'.

Changing the default colour like this is probably the easiest option, of course a more elegant solution is to override the UI for the progress bar with your own, but I didn't have time to spend on that.

So a single line of code like this does the trick:
UIManager.put("nimbusOrange", new Color(232, 21, 26));

This results in a red progress bar.

Changing the Color parameters when instantiating the Colour class in the line above will change the colour displayed, it's a simple RGB (red, green, blue) combination.


A quick disclaimer...

Although I put in a great effort into researching all the topics I cover, mistakes can happen. Use of any information from my blog posts should be at own risk and I do not hold any liability towards any information misuse or damages caused by following any of my posts.

All content and opinions expressed on this Blog are my own and do not represent the opinions of my employer (Oracle). Use of any information contained in this blog post/article is subject to this disclaimer.
Hi! You can search my blog here ⤵
NOTE: (2022) This Blog is no longer maintained and I will not be answering any emails or comments.

I am now focusing on Atari Gamer.