Convert JPanel into png or other image file?

The java.awt. Robot classes can take a screen dump which you can then put where you need it for later.

I think Robots are what I am looking for. Thank you. – Cherie Jun 8 at 19:26.

Like this: BufferedImage image = new Robot(). CreateScreenCapture(new Rectangle(panel. GetLocationOnScreen().

X, panel. GetLocationOnScreen(). Y, panel.getWidth(), panel.getHeight())); ImageIO.

Write(image, "png", file); You create a file like this: File file = new File("fileName. Png"); if (!file.exists())file.createNewFile(); please select my answer as correct if I answered your question :).

Thanks. This should work. Yet, er, how do I create a new file?

I'm a little confused about how to File class works, I think. – Cherie Jun 8 at 19:31.

Screen Image will choose the best way to create the image. BufferedImage bi = ScreenImage. CreateImage(panel); ScreenImage.

WriteImage(bi, "panel. Png").

It takes two lines of code, one to create the image and the second to save it. – camickr Jun 8 at 19:56.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions