overrides nimbus properties

拜拜、爱过 提交于 2019-12-12 01:49:21

问题


I'm trying to overrides some of the nimbus properties for JLabel.

UIDefaults labelDefault = new UIDefaults();
    labelDefault.put("Label.font", new FontUIResource("Arial", Font.PLAIN, 14));
    labelDefault.put("Label.foreground", new ColorUIResource(210, 210, 210));
label.putClientProperty("Nimbus.Overrides", labelDefault);
    label.putClientProperty("Nimbus.Overrides.InheritDefaults",false);

For the font it works correctly, but not for the color. Is it possible to change the color this way ? Thank you.


回答1:


this works:

labelDefault.put("Label[Enabled].textForeground", new ColorUIResource(210, 210, 210));


来源:https://stackoverflow.com/questions/5835129/overrides-nimbus-properties

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!