0

I want to convert jpanel into image file which is not currently active(ie, that jpanel is hidden).

Please guide me how to do that? Is there any possible?

Thanks in advance..

Babu R
  • 1,025
  • 8
  • 20
  • 40
  • http://stackoverflow.com/questions/14551646/convert-a-jpanel-to-an-image-in-a-jscrollpane/14552324#14552324 may be of some help. – VGR Mar 21 '13 at 08:57

1 Answers1

1
  • you can to create BufferedImage from any of JComponents that returns Dimension

.

BufferedImage bufferedImage = new BufferedImage ((int)panel.getSize().getWidth(),
             (int)panel.getSize().getHeight(), BufferedImage.TYPE_INT_RGB);
mKorbel
  • 109,525
  • 20
  • 134
  • 319
  • thanks for your reply. But this is working for currently active panel. I have asked about hidden panel? – Babu R Mar 21 '13 at 08:26
  • [returns Dimension, for example(@David Kroukamp)](http://stackoverflow.com/a/14551679/714968) – mKorbel Mar 21 '13 at 08:50