aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes awt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "awt" Watch "awt" New topic
Author

awt

Asim Abbasi
Greenhorn

Joined: Feb 24, 2004
Posts: 2
How can i set image in background of a Frame
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
This isn't really anything to do with servlets, so I've moved it to our Swing/AWT forum, where you should get more useful answers.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

For an AWT frame all you need to do is override the paint( Graphics ) method of the frame to draw your image. You can either hardcode the image somewhere (like the constructor of the frame subclass) or have a pair of setImage()/getImage() methods.



However, Swing presents a better solution... since AWT uses native components, child components in the Frame will cover up the background image. Swing allows most child components to call setOpaque( false ) and allow their parent's background to show through. I have covered the way to do this in Swing here.


-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: awt