Refer to this bug:
4848910 : UIManager only updates colors once
I have two buttons on a JFrame. From first button I am changing LAF Color by
UIManager.put( "Button.background", new ColorUIResource(Color.red) );
SwingUtilities.updateComponentTreeUI( this.getContentPane() );
and on second button I am changing LAF color with
UIManager.put( "Button.background", new ColorUIResource(Color.green) );
SwingUtilities.updateComponentTreeUI( this.getContentPane() );
Here I am using ColorUIResource (as described by the resolution of the bug) but my problem remains the same as described in the refered bug. i.e. UIManager changes the color when any of the button gets clicked for the very first time but doesnt changes the color on subsequent clicks.
Am I missing something? Any help would be appreciated.