Setting tab title colors on JTabbedPanes

▼魔方 西西 提交于 2019-12-07 08:43:24

It seems like what you want are the setForegroundAt and setBackgroundAt methods in JTabbedPane.

I want to change the colors for all of them and let Swing handle knowing which tab is currently selected.

That wouuld be a LAF implementation. You can check out UIManager Defaults. For the Metal LAF it looks like background selected/unselected can be controlled but I don't see anything for the foreground font color.

So I would say you would need to add a ChangeListener to the tabbed pane. Then you can manually reset the selected background/foreground using the methods provided by Kainsin.

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