使用Java Robot类采取截图与Java小程序不工作 [英] Taking screenshot with Java applet using Java Robot class not working

查看:574
本文介绍了使用Java Robot类采取截图与Java小程序不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是Java小程序采取网络浏览器的截图,使用Java的Robot类。

 机器人objRobot =新的机器人();
BufferedImage的objBufferedImage = objRobot.createScreenCapture(objRectArea);

事情在Windows系统工作良好,以截图。但是,在Mac OS X的情况下,我得到一个空白的形象。

当我检查事件查看器,我看到了以下错误:

 无效的上下文
无效的像素格式
CoreAnimation:渲染错误506

问题发生的所有浏览器Safari浏览器,Firefox和Chrome。我的applet是已签名Applet。

可能是什么原因呢?

我的机器配置如下:

 操作系统:Mac OS X
版本:10.6.4


解决方案

我发送的错误消息无效的像素格式谷歌和收到的效果一长串(接近10.000) - 它看起来好像这个问题是不是Java的问题,但您的Mac

在配置问题。

尝试改变显示分辨率和重新运行小程序。好机会,该错误链接到一些屏幕分辨率(外接显示?)。在网络上提出了一些建议,才能全面更新你OSX。

I am using a Java applet to take a screenshot of the web browser, using Java's Robot class.

Robot objRobot = new Robot ();
BufferedImage objBufferedImage = objRobot.createScreenCapture(objRectArea); 

The thing works good in Windows system, taking screenshot. But in case of Mac OS X I get a blank image.

When I check the event viewer, I see the following error:

invalid context
invalid pixel format
CoreAnimation: rendering error 506

The problem is occurring for all the browsers Safari, Firefox and Chrome. My applet is a signed applet.

What might be the reason?

My machine configuration is as follows:

OS : MAC OS X
Version : 10.6.4

解决方案

I've sent the error message invalid pixel format to google and received a long list of results (close to 10.000) - it looks as if the problem is not a Java problem but a configuration issue on your Mac.

Try to change display resolutions and re-run your applet. Good chance, that the error is linked to some screen resolutions (external display?). Some suggestions on the web were to fully update you OSX.

这篇关于使用Java Robot类采取截图与Java小程序不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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