在 Java 中嵌入 Web 浏览器窗口
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/294813/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Embedding web browser window in Java
提问by Elijah
Does anyone know a way to open up an instance of the platform's (Windows/Linux/Mac) browser within a Swing window that is integrated into a Java application. No other actions would be preformed other than opening a given URL. Currently, we open a new browser window because the Java embedded browsers have been insufficient. However, from a user interaction standpoint this is less than desirable.
有谁知道在集成到 Java 应用程序中的 Swing 窗口中打开平台(Windows/Linux/Mac)浏览器实例的方法。除了打开给定的 URL 之外,不会执行其他操作。目前,我们打开一个新的浏览器窗口,因为Java嵌入式浏览器已经不够用了。然而,从用户交互的角度来看,这并不理想。
I'm curious if a solution for this was part of the 1.6 Java release. So, far my google-foo has not turned up anything of note. Are there any closed-source libraries that do this? Anything?
我很好奇这个解决方案是否是 1.6 Java 版本的一部分。所以,到目前为止,我的 google-foo 还没有发现任何值得注意的东西。是否有任何闭源库可以做到这一点?任何事物?
回答by Fuangwith S.
use JEditorPane
A text component to edit various kinds of content. By default, the following types of content are known: text/plain, text/html and text/rtf
用于编辑各种内容的文本组件。默认情况下,已知以下类型的内容:text/plain、text/html 和 text/rtf
or Lobo
或路宝
Lobo is an open source web browser that is written completely in Java.
Lobo 是一个完全用 Java 编写的开源 Web 浏览器。
回答by Sergey Borodavkin
We use JDIC as well and it works for us in Windows; however, configuring it to work in *nix/OS X can be a pain, as it simply utilizes a platform-native browser (supports IE and Mozilla), while on Linux/Mac you may have neither - that's the problem.
我们也使用 JDIC,它适用于我们在 Windows 中;然而,将它配置为在 *nix/OS X 中工作可能会很痛苦,因为它只是利用平台原生浏览器(支持 IE 和 Mozilla),而在 Linux/Mac 上,您可能两者都没有——这就是问题所在。
回答by Michael Borgwardt
WebRendereris a commercial product that does this, and does it well. However, the last time I checked it was also pretty expensive (they wanted a $2 per-client fee for a largenumber of client, and a several $1000 support contract).
WebRenderer是一个商业产品,可以做到这一点,而且做得很好。但是,我上次检查时也很贵(他们希望为大量客户支付每客户 2 美元的费用,以及几份 1000 美元的支持合同)。
回答by Michael Borgwardt
MozSwing it is free or JxBrowser or JExplorer ($500)
MozSwing 它是免费的或 JxBrowser 或 JExplorer(500 美元)

