File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Mac OS X makes my JLayeredPanes Pink. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Mac OS X makes my JLayeredPanes Pink." Watch "Mac OS X makes my JLayeredPanes Pink." New topic

Mac OS X makes my JLayeredPanes Pink.

Ted Reynolds

Joined: Mar 16, 2004
Posts: 20
I have written an application that uses JLayeredPanes to paint the background texture on all my dialogs and such. This works great on Windows and Unix, but when I run it on Mac OS X they all have a pink color to them. Can anyone tell me why and how to change it so the pink caste goes away.
Here's and example of one of my dialogs:
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

I'm not sure why your JLayeredPane is pinkish on OS X... maybe it's just that color in the Mac look and feel. Take a look at the UIManager class for the methods you need to check the current look and feel, use a different look and feel, or bind a different color to be a components "default".

From just the code you've shown me, there's not a lot of a reason to use a JLayeredPane... you only need to use a JLayeredPane if you want to add components on top of each other. If you just need to paint something in the background you can just use a regular old JPanel.

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Ted Reynolds

Joined: Mar 16, 2004
Posts: 20
Thanks for the information. I'll check with someone I know (now) at apple on the pink thing. I have tried to use JPanels to paint the background and could not get them to work properly, either only the buttons would display or the image I wanted in the background would display with the buttons showing up only after I hovered over their position with the mouse. whereas the JLayeredPanes I could get to work. Anyway thanks for the info.
I agree. Here's the link:
subject: Mac OS X makes my JLayeredPanes Pink.
It's not a secret anymore!