Hi I'm trying to create a program that uses a image as a background.
When i figured out how to set the image to the background of the gui it
wouldn't let me place buttons or textfields on top of it. This is how i
did it...
((JPanel)getContentPane()).setOpaque(false);
ImageIcon image = new ImageIcon("usamap.gif");
JLabel backlabel = new JLabel(image);
getLayeredPane().add(backlabel, new Integer(Integer.MIN_VALUE));
backlabel.setBounds(0,0,image.getIconWidth(), image.getIconHeight());
This way I was unable to place the buttons i needed over top. So I
tried to use the glass pane for that which worked but now my menu bar
does not respond. Any ideas on how I could fix this problem or a
better way to place the image in the background and still use buttons
on it would be greatly apreciated.
Thanks
Monique Y. Mudama - 23 Apr 2006 19:01 GMT
> Hi I'm trying to create a program that uses a image as a background.
> When i figured out how to set the image to the background of the gui it
[quoted text clipped - 12 lines]
> better way to place the image in the background and still use buttons
> on it would be greatly apreciated.
I've never used it, but what about the OverlayLayout?
http://www.java2s.com/Code/Java/Swing-JFC/AtestoftheOverlayLayoutmanagerallowing
experimentation.htm

Signature
monique
Help us help you:
http://www.catb.org/~esr/faqs/smart-questions.html
BugFree - 23 Apr 2006 22:16 GMT
I don't really know anything about the overlay layout i'm not sure i
know how to use it but i'll give it a try
thanks