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

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:
nimbus1.png


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.
nimbus2.png


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.

-i

Skip down to comments...
Hope you found this post useful...

...so please read on! I love writing articles that provide beneficial information, tips and examples to my readers. All information on my blog is provided free of charge and I encourage you to share it as you wish. There is a small favour I ask in return however - engage in comments below, provide feedback, and if you see mistakes let me know.

If you want to show additional support and help me pay for web hosting and domain name registration, donations, no matter how small, are always welcome!

Use of any information contained in this blog post/article is subject to this disclaimer.
 
comments powered by Disqus
Other posts you may like...