Reputation: 7894
On a JTabbedPane, how do you set the color of the tab titles for both the selected and unselected states?
Upvotes: 1
Views: 4751
Reputation: 324207
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.
Upvotes: 3
Reputation: 447
It seems like what you want are the setForegroundAt
and setBackgroundAt
methods in JTabbedPane
.
Upvotes: 5