Does anyone know how to capture a screen shot in Java (not it\'s own screen, but any other window on the desktop and they don\'t necessarily have to be the
Use java.awt.Robot.createScreenCapture().
Here's an example:
try {
Robot robot = new Robot();
Rectangle size = new Rectangle(Toolkit.getDefaultToolkit()
.getScreenSize());
BufferedImage buf = robot.createScreenCapture(size);
ImageIO.write(buf, "png", new File("d:/test.png"));
} catch (AWTException ae) {
throw new RuntimeException("something went wrong");
}
Code originally stolen from here.