See also e670 缓冲图像转换为图像.

    try {
        Robot robot = new Robot();
    
        // Capture a particular area on the screen
        int x = 100;
        int y = 100;
        int width = 200;
        int height = 200;
        Rectangle area = new Rectangle(x, y, width, height);
        BufferedImage bufferedImage = robot.createScreenCapture(area);
    
        // Capture the whole screen
        area = new Rectangle(Toolkit.getDefaultToolkit().getScreenSize());
        bufferedImage = robot.createScreenCapture(area);
    } catch (AWTException e) {
    }

 

Related Examples

版权声明:本文为borter原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/borter/p/9596214.html