拍摄"截图" Java小程序的 [英] Taking a "screenshot" of a java applet
问题描述
没有。没有pressing PRT屏幕。但这里是我想要的。我需要知道,如果这是可以做到通过什么手段:D
No. Not pressing PRT Screen. But here is what I want. And I need to know if it can be done and by what means :D
好了,所以我有一个运行并显示一个行走的人的Java小程序。
我需要它,所以当我访问一个脚本(在某些Web脚本语言),它需要的小程序屏幕截图,然后将其保存在服务器上。这可能吗?通过什么手段脚本我能做到吗?
Okay so I have a java applet that runs and displays a walking man. I need it so when I access a script (in some web scripting language) it takes a "screenshot" of that applet and then saves it on the server. Is this possible? and by what scripting means could I do it?
在此先感谢!
推荐答案
如果有重量级组件,他们可能没有出来,但显而易见的方法是:
If there are heavyweight components they might not come out, but the obvious way is:
- 创建一个
java.awt.image.BufferedImage中的
- 呼叫
的createGraphics
来创建一个图形
实例。 - 呼叫
更新(图形)
上的小程序。 - 找到的教程,用于将
的BufferedImage
来的导线文件格式。 - 回发到Web服务器。
- Create a
java.awt.image.BufferedImage
- Call
createGraphics
to create aGraphics
instance. - Call
update(Graphics)
on the applet. - Find a tutorial for converting the
BufferedImage
to a wire file format. - POST back to the web server.
您可以使用LiveConnect的连接Java与JavaScript之间左右逢源。它通常是很容易简单地通过增加另一个参考Applet标记的存档属性为Java code添加到一个小应用程序。
You can use LiveConnect to connect both ways between Java and JavaScript. It's usually easy to add Java code to an applet simply by adding another reference to the archive attribute of the applet tag.
有大量的各部分教程。我从来没有做过它自己。
There are plenty of tutorials on the various parts. I've never done it myself.
这篇关于拍摄"截图" Java小程序的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!