Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.
Notice: I'm taking a break from blogging to focus on Atari Gamer . com, check it out!

NOTE: This article is 3 years or older so its information may no longer be relevant. Read on at your own discretion! Comments for this article have automatically been locked, refer to the FAQ for more details.
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.


Skip down to comments...
A quick disclaimer...

Although I put in a great effort into researching all the topics I cover, mistakes can happen. If you spot something out of place, please do let me know.

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.
comments powered by Disqus
Other posts you may like...