UIManager不会设置按钮背景

时间:2014-09-17 17:42:21

标签: java swing look-and-feel nimbus uimanager

全部,我正在使用java swing的UIManager来设置这个主题

UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");

这个主题在区分按钮的禁用/启用背景方面很糟糕,所以我一直在努力尝试让这个更改禁用的背景。没有什么对我有用。我不明白我做错了什么,下面是我到目前为止的所有方法

//My color constant
Color disabledButton = new Color(255,124,124);

//Maybe its these?
UIManager.put("Button.background", disabledButton);
UIManager.put("Button.foreground", disabledButton);

//No maybe this...
UIManager.put("Button.disabled", disabledButton);

//Okay how about this
UIManager.put("Button.disabled", "DerivedColor(color=255,124,124 parent=control offsets=0.0,0.0,0.0,0 pColor=255,124,124");

//NO!!?!?! WELL FINE ILL SET THE BACKGROUND MYSELF
myButton.setBackground(disabledButton);

这些都不起作用......我在哪里犯错误?

0 个答案:

没有答案