The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
January 2002



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


Saving 2 pictures drawn on a JPanel as one

Posted by Manpreet Minhas on January 04, 2002 at 12:40 AM


I have a JPanel with 2 pictues drawn on it and the background color set as blue.I want to save it as one including the Background. Any idea how to do this.

i tried the following code but it didn't help

Rectangle rec = panel.getBounds();
// where panel is the JPanel on which the pictures are drawn and
// background color set to blue
Image img = rec.createImage(rec.width,rec.height);
// and i try saving the above image object but it saves a blank panel with no background color.

Help required as soon as possible.
Thanks in advance


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us