Screenshot
The snippet can be accessed without any authentication.
Authored by
wirnersv60307
Edited
screenshot.java 357 B
public static BufferedImage doScreenshot(JComponent component) {
int width = component.getWidth();
int height = component.getHeight();
BufferedImage screenshot = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics2D graphics2D = screenshot.createGraphics();
component.paint(graphics2D);
return screenshot;
}
Please register or sign in to comment