Nimbus 改变选项卡标题的颜色
我想更改选项卡标题的颜色。
我尝试设置不同的属性,但没有任何变化。
在我的 main 中,我将属性 text
设置为白色,因此所有文本都是白色的。
现在我想更改一些组件文本,例如选项卡窗格,但它没有改变。
UIDefaults tabPaneDefaults = new UIDefaults();
tabPaneDefaults.put("textBackground", new ColorUIResource(Color.black));
tabPaneSettings.putClientProperty("Nimbus.Overrides", tabPaneDefaults);
tabPaneSettings.putClientProperty("Nimbus.Overrides.InheritDefaults",false);`
I would like to change the color from my tabs title.
I tried to set different properties, but nothing is changing.
In my main I set the property text
to white so all text is white.
Now I would like to change some of the components text, like the tab pane but it is not changing.
UIDefaults tabPaneDefaults = new UIDefaults();
tabPaneDefaults.put("textBackground", new ColorUIResource(Color.black));
tabPaneSettings.putClientProperty("Nimbus.Overrides", tabPaneDefaults);
tabPaneSettings.putClientProperty("Nimbus.Overrides.InheritDefaults",false);`
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为设置文本背景的实际值是“TabbedPane.background”。所以你的代码应该从以下开始:
I think actual value for setting text background is "TabbedPane.background". So your code should start with:
Nimbus TabbedPaneTabPainter 非常复杂。参见甲骨文:
TabedPaneTabPainter
您必须将
“nimubsBase”设置为深色。
将按钮等设置为匹配的颜色看起来很不错。选择
找到一对漂亮的颜色需要一些时间。有时即使很小的变化也会产生很大的影响,有时大的变化几乎没有影响。这是因为颜色的计算复杂。
The Nimbus TabbedPaneTabPainter is very complicated. See Oracle:
TabedPaneTabPainter
You have to set
"nimubsBase" to a dark color.
It looks nice to set buttons, etc. to a matching color. Choose
It takes some time to find a nice pair of colors. Sometimes even little changes have a great effect, sometimes large changes have almost no effect. It is because of the complicated calculation of colors.