I found the solution to this problem. I used the CustomTabbedPaneUI class posted by mKorbel at this link: How can I change the shape of a JTabbedPane tab? I then modified the paintTabBackground method so that the background colour of a disabled tabbed pane is white.
Change colour of disabled JTabbedPane
-
08-07-2023 - |
Question
I have a JTabbedPane with eight tabs. I have disabled one of the tabs using the code
jtp.setEnabledAt(7, false);
My problem is that the tab label (just for the disabled tab) now has a dark grey background colour and I would like to change that. I tried the method setBackgroundAt but nothing happened. I checked the UIManagerDefaults (http://tips4java.wordpress.com/2008/10/09/uimanager-defaults/) but found nothing there about the colour of a disabled tabbed pane. How can I change this colour? Thanks.
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow