在 Java AWT 框架上托管 ActiveX 控件?
有没有办法在 Java AWT 框架中显示 Flash 或 Adobe Reader ActiveX 控件?
我正在将一个大型旧 J++ 应用程序移植到标准 Java,它需要在 AWT 框架上托管某个 ActiveX 控件。
这可能吗?
我查看了JACOB(Java to COM Bridge)项目 并且它似乎不支持在屏幕上绘制的 ActiveX 对象。
Is there a way to display a Flash or Adobe Reader ActiveX control in a Java AWT frame?
I'm porting a large old J++ application to standard Java and it needs to host a certain ActiveX control on an AWT frame.
Is this possible?
I looked at the JACOB (Java to COM Bridge) project and it doesn't appear to support ActiveX objects that draw on the screen.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来这可以通过混合 AWT 和 SWT 来完成。
Eclipse 项目有一个示例片段 将 Microsoft Word 嵌入到 AWT/SWT 混合应用程序中。
It looks like this can be done by mixing AWT and SWT.
The Eclipse project has a sample snippet that embeds Microsoft Word into an AWT/SWT mixed app.
看来您需要购买专有库才能执行此操作,因为 Java 本身不允许访问 COM。 另一个类似的问题(仅关于 Java 中的 Flash)可以在这里找到并列出了一些商业解决方案。
我应该指出,无论您最终采取什么方式,您最好尝试找到一个提供对 Internet Explorer 控件的访问的库,而不仅仅是 Flash 或 Adobe Reader。 这是因为,一旦您有权访问 IE 元素,您就可以向它提供 .swf 或 .pdf 文档的 URL(即使它是本地文件),并且它会自动为每个文档加载正确的插件(我使用这个快捷方式曾经用于个人 C++ 项目,其中我需要加载几个不同的 ActiveX 控件)。 看来上述链接中的 EasyJCom 库确实提供了对嵌入式 IE 控件的此类访问。
It appears that you will need to purchase a proprietary library in order to able to do this, as Java itself doesn't allow access to COM. Another similar question (about just Flash in Java) can be found here and a couple commercial solutions were listed.
I should note that whatever route you end up taking, you should optimally try to find a library that provides access to an Internet Explorer control, as opposed to just Flash or Adobe Reader. That's because, once you have access to an IE element, you can provide it with a URL (even if it's a local file) of either a .swf or .pdf document, and it will automatically load the correct plugin for each (I used this shortcut once for a personal C++ project in which I needed to load several different ActiveX controls). It appears that the EasyJCom library at the above link does provide such access to an embedded IE control.