-1
所以做某些动作的问题我做了一些代码,截图功能如何在我的Java项目采取的屏幕截图
现在这是我做了
public void takeScreenshot() {
try {
Window window = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow();
Point point = window.getLocationOnScreen();
int x = (int)point.getX();
int y = (int)point.getY();
int w = window.getWidth();
int h = window.getHeight();
Robot robot = new Robot(window.getGraphicsConfiguration().getDevice());
Rectangle captureSize = new Rectangle(x, y, w, h);
java.awt.image.BufferedImage bufferedimage = robot.createScreenCapture(captureSize);
int picNumber = random(100);
String fileExtension = "The Iron Door";
File file = new File((new StringBuilder()).append(SignLink.getCacheDirectory() + "Screenshots/" + fileExtension + " ").append(picNumber).append(".png").toString());
ImageIO.write(bufferedimage, "png", file);
} catch(Exception e) {
e.printStackTrace();
}
}
现在的代码代码完美的作品我有它设置上做热键的操作,现在我有两个问题
1)如何将添加某种它周围的边框是由我预先制作,并在用户需要的屏幕截图将边框放在图像上
2)我会怎么做它使用户可以输入他们想要的截图被称为