package app;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
public class Main
{
public static void main(String[] args) throws AWTException, IOException
{
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice[] gd = ge.getScreenDevices();
for (int i = 0; i < gd.length; i++) {
Rectangle rectangle = gd[i].getDefaultConfiguration().getBounds();
BufferedImage image = new Robot().createScreenCapture(rectangle);
ImageIO.write(image, "png", new File("screenshot_" + i + ".png"));
}
}
}
Leave a Comment
Cancel reply