How to set all Java Swing GUI component backgrounds and foreground(fonts) colors at once?

Philip Nguyen picture Philip Nguyen · Feb 14, 2012 · Viewed 11.3k times · Source

I have tons of jbuttons, jtextfields, jlabels, jmenus, gui items and it is extremely time consuming to set the background color and foreground color one at a time.

I want to be able to color the fonts(foreground) and backgrounds all the jmenus, jmenuitems,jtextfields,jbuttons, etc quickly/concisely in my project instead of having to set them one at a time.

Is there any technique to do this more concisely instead of doing it one at a time?

Answer

mKorbel picture mKorbel · Feb 14, 2012

1) most eficient way would be to use Custom Look and Feel, part of them have got a nice Themes

2) set value to the UIDefault, Listing UIDefault Properties

EDIT:

best of all UIManager Defaults by @camickr