开发者

Java print screen program

I am trying to use Robot in Java to make an image file of a print screen. So far I have:

 Robot robot = new Robot();
 Rectangle screenRect = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
 BufferedImage capture = new Rob开发者_Python百科ot().createScreenCapture(screenRect);
 ImageIO.write(capture, "bmp", new File("printscreen.bmp"));

But I can't seem to get it to create the file.


s/printscreen.bmp/"printscreen.bmp"


Not sure if .bmp files are support. Oops, they are:

System.out.println( Arrays.asList( ImageIO.getWriterFileSuffixes() ) );

You can also use the Screen Image class for some more general screen printing features.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜