0

I have a transparent jframe that has scrolling text on it, and I need to capture just the jframe and not whats behind it. At first, java.awt.Robot looked promising, but it doesn't capture only the graphics context of the jframe. Maybe somebody knows a portion of the API that could help with this...

1 Answers1

5

You can

  1. Create a BufferedImage with the JFrame's size
  2. Call the JFrame's print() method with the BufferedImage's graphics

Code:

BufferedImage image = new BufferedImage(frame.getWidth(), frame.getHeight(), BufferedImage.TYPE_INT_RGB);
frame.print(image.getGraphics());
sina72
  • 4,931
  • 3
  • 35
  • 36