Question

Can someone give me advice on how can I the change tab (only in the tab itself, not the tab's content area) in JTabbedPane to an icon. It is possible to set another icon when the tab is selected, another icon on mouse over, and another icon when tab isn't selected. I'd like to have this icon on full tab width and height under the text, similar like when one replaces a whole button with an image.

Was it helpful?

Solution

Take a look at setTabComponent, this will allow you to supply a custom renderer for that tab

You would then need to monitor changes to the tab selection via the changeListener, when the tab changes, you would use the getTabComponentAt method to get the renderer and update it

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top