覆盖nimbus属性 [英] overrides nimbus properties

查看:104
本文介绍了覆盖nimbus属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试覆盖JLabel的某些nimbus属性.

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.

推荐答案

这有效:

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

这篇关于覆盖nimbus属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆