【发布时间】:2012-12-18 18:45:56
【问题描述】:
参考这个错误:
4848910 : UIManager only updates colors once
我在 JFrame 上有两个按钮。从第一个按钮开始,我将 LAF 颜色更改为
UIManager.put( "Button.background", new ColorUIResource(Color.red) );
SwingUtilities.updateComponentTreeUI( this.getContentPane() );
在第二个按钮上,我正在使用
更改 LAF 颜色UIManager.put( "Button.background", new ColorUIResource(Color.green) );
SwingUtilities.updateComponentTreeUI( this.getContentPane() );
这里我使用的是 ColorUIResource(如 bug 的解决方案所述),但我的问题与引用的 bug 中描述的相同。即 UIManager 在第一次单击任何按钮时更改颜色,但在后续单击时不会更改颜色。
我错过了什么吗?任何帮助将不胜感激。
【问题讨论】:
标签: java swing colors nimbus uimanager