Robke

Weblog

JPanels on the Mac

Op 10 april 2005 om 13u04 in Java.
Geen reacties »

This maybe is a bit nitpicking, but I see it a lot in Java applications on the Mac. Apple has made a big effort to make Swing apps look exactly like native apps. Buttons glow, JPanels get a nice striped background. But the problem is that a JPanel always gets that background, even in a JTabbedPane, where it shouldn’t.

jpanel

So next time if you write a Swing application for the Mac, or if you port one to our favourite platform, take a moment to do this:

myJPanel.setOpaque(false);

This will make the JPanel transparent (or: not opaque).