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

| Views: 7762
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.


Have comments or feedback on what I wrote? Please share them below! Found this useful? Consider sending me a small tip.
comments powered by Disqus
Other posts you may like...