wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Saving JPanel as image Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Saving JPanel as image" Watch "Saving JPanel as image" New topic
Author

Saving JPanel as image

Jeff Storey
Ranch Hand

Joined: Oct 09, 2006
Posts: 118
I'm trying to save the contents of a JPanel as an image. It is pretty straightforward to write the graphics to a BufferedImage, however, the problem is when all of the JPanel is not actually displayed on the screen (in this particular case, it's not in a scrollpane, but I cannot change this). The getGraphics method only returns what is visible - is there any way to get the non-visible portion also?

Thank you,
Jeff
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
couple of ideas here

http://forum.java.sun.com/thread.jspa?threadID=604040
Jeff Storey
Ranch Hand

Joined: Oct 09, 2006
Posts: 118
Thanks - That's where I got my start from. The main difficulty is still when the JPanel area is not visible and not in a scrollpane - thought there might be a different way.
Jeff Storey
Ranch Hand

Joined: Oct 09, 2006
Posts: 118
I think I just have to get it into a scroll pane.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Saving JPanel as image
 
Similar Threads
Cannot add an image to JPanel. Nothing works:(
Graphic JButon on JPanel
Double Buffering in jdk1.4.1_02
How do I layer components on top of each other without blocking lower components?
placing swing components