0

I a have a JPanel where I have drawn some lines. Now I want to pass those graphics as a BufferedImage to another class, but I don't know how. I know the way to get the graphic2D object of a BufferedImage and draw on it, but how to do the reverse?

dirac
  • 309
  • 1
  • 9

1 Answers1

1

You need to create a BufferedImage of the panel.

Check out the Screen Image class. It allows you to create an Image of any Swing component.

camickr
  • 321,443
  • 19
  • 166
  • 288