Java实现屏幕截图获取需要使用java.awt包下的工具类
一个最简单的获取屏幕截图的代码实现如下所示:
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;
public class ScreenshotGetter {
public BufferedImage getScreenshot() throws AWTException {
final Robot robot = new ...