开发者

Nimbus changing color of the title of a tab

开发者 https://www.devze.com 2023-02-22 04:50 出处:网络
I would like to change the color from my tabs title. I tried to set differe开发者_StackOverflow中文版nt properties, but nothing is changing.

I would like to change the color from my tabs title.

I tried to set differe开发者_StackOverflow中文版nt 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);`


I think actual value for setting text background is "TabbedPane.background". So your code should start with:

UIDefaults tabPaneDefaults = new UIDefaults();
    tabPaneDefaults.put("TabbedPane.background", new ColorUIResource(Color.black));


The Nimbus TabbedPaneTabPainter is very complicated. See Oracle: TabedPaneTabPainter

You have to set

UIManager.put("nimbusBase", *here dark Color*);

"nimubsBase" to a dark color.

It looks nice to set buttons, etc. to a matching color. Choose

UIManager.put("nimbusBlueGrey", *here light Color*);

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号