通过java代码截取电脑屏幕全屏代码如下:
import java.awt.AWTException;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException; import javax.imageio.ImageIO; public class SeleniumDemo { public static void main(String args[]) throws IOException, AWTException, InterruptedException { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
int screenWidth = (int) screenSize.getWidth();
int screenHeight = (int) screenSize.getHeight();
Robot robot=new Robot();
BufferedImage bi=robot.createScreenCapture(new Rectangle(screenWidth,screenHeight));
ImageIO.write(bi, "jpg", new File("C:\\Users\\XXX\\Desktop\\screen\\1.jpg")); }
}