Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Saving JPanel as image

 
Jeff Storey
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
couple of ideas here

http://forum.java.sun.com/thread.jspa?threadID=604040
 
Jeff Storey
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I just have to get it into a scroll pane.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic