I am collecting JFrame screenshots using the "double buffering" method below:
public BufferedImage getScreenshot() {
java.awt.Dimension dim = this.getPreferredSize();
BufferedImage image = new BufferedImage(dim.width, dim.height, BufferedImage.TYPE_INT_RGB);
this.paint(image.getGraphics());
return image;
}
where thisextends JFrame. The image I get has an empty bar along the top where the caption was. What is the easiest way to capture an image of JFrame content without the extra space allocated for the title?
source
share