简体   繁体   English

Java:最小化窗口的“屏幕截图”?

[英]Java: “Screenshot” of a minimized window?

I'm currently writing a script that works inside of a game client, and I want to add screenshot capability to my script. 我目前正在编写一个可在游戏客户端中使用的脚本,并且我想为脚本添加屏幕截图功能。 I'm using Robot now, but I would like to be able to take a screenshot of the client even if it is minimized. 我现在正在使用Robot,但是即使最小化了,我也希望能够对其进行截图。 Is there any way of doing this? 有什么办法吗? If so, how? 如果是这样,怎么办?

I know that this is possible in other languages because I've seen it done in other applications in the past but my worry is that the JVM won't be capable of doing this. 我知道这在其他语言中也是可行的,因为我过去曾在其他应用程序中看到过这种情况,但我担心的是JVM无法做到这一点。

I've never tried it but you should be able to use the Screen Image class. 我从未尝试过,但是您应该可以使用Screen Image类。 It uses the paint() method of the component so I don't think it matters if the frame is minimized or not. 它使用组件的paint()方法,因此无论框架是否最小化,我都认为无关紧要。 The only thing is you will need to get the image of the content pane not the frame. 唯一的事情是您将需要获取内容窗格的图像而不是框架。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM