拍摄“屏幕截图"一个java小程序 [英] Taking a "screenshot" of a java applet

查看:31
本文介绍了拍摄“屏幕截图"一个java小程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

没有.不按 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 来创建一个 Graphics 实例.
  • 在小程序上调用 update(Graphics).
  • 查找将 BufferedImage 转换为 Wire 文件格式的教程.
  • POST 回网络服务器.
  • Create a java.awt.image.BufferedImage
  • Call createGraphics to create a Graphics 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 之间进行双向连接.向小程序添加 Java 代码通常很容易,只需添加对小程序标记的存档属性的另一个引用即可.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆