aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes setting background image in applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "setting background image in applet" Watch "setting background image in applet" New topic
Author

setting background image in applet

Alex Kravets
Ranch Hand

Joined: Jan 24, 2001
Posts: 476
Hello,
How do I set background image for an applet, where I use GridBagLayout to position my components? Can I set a background for a JPanel, and then in turn add components to that JPanel using GridBagLayout?
thanks,
Alex


All right brain, you don't like me and I don't like you, but let's just do this one thing so I can get back to killing you with beer.<br /> <br />- Homer Simpson
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

Yes... but you'll have to make a special JPanel that will paint the image in the background... and make sure that any JPanels you add to it have setOpaque( false ) set on them so the Image shows through... and make sure to use the Java 2 Plugin to use Swing in your applets!

Here's some code to illustrate an implementation of the JPanel with the background image...



-Nate


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: setting background image in applet