I am not a fan of the usage of notebook like widgets because I think that they tend to make the application interface cluttered, I prefer wizard like structures, but sometimes they are the best solution available. In Java this kind of component is called a JTabbedPane
For some reason when looking a JTabbedPane with the Windows look and feel on Windows XP (Luna theme), a small anoyance is revealed: JPanel components on the JTabbedPane are opaque thus hiding the tabbed pane default background, like this:

To solve this remember to set your JPanels and other components like radio buttons and checkboxes non opaque:
panel.setOpaque(false);
and you will get a nicer tabbed pane

Update 07/06/2005: I forgot to tell that this only works with JSE 5.0 because the Windows Look and Feel on previous releases did not implemented the correct JTabbedPane background
Update 07/08/2005: This probably is a bug in the Sun implementation as said by one of the commentators, but I think they will not change that because JPanels on the Windows L&F has been always opaque. My solution involves the usage of a custom utility method that traverse the components tree and change the opacity for the panels when the Windows L&F is active.










Comments (4) |
Trackbacks (0)
Re: JTabbedPane background on Windows XP
Swapnonil Mukherjee | 07/07/2005, 18:53
A lot of people have noticed this discrepancy and this is indeed a bug.
Ideally we should not be required to take a panel and each component on it, and set it to non-opaque.
This is so bloody awful.