Java截取屏幕 发表于 2017-04-23 1234567891011121314public static void captureScreen(String fileName) throws Exception { Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Rectangle screenRectangle = new Rectangle(screenSize); Robot robot = new Robot(); BufferedImage image = robot.createScreenCapture(screenRectangle); ImageIO.write(image, "png", new File(fileName));}public static void main(String[] args) { try { captureScreen("F:\\Test22.png"); } catch (Exception e) { // TODO Auto-generated catch block }}