在 Java 应用程序中嵌入 Web 浏览器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/943927/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 21:22:54  来源:igfitidea点击:

Embed a web browser within a java application

javabrowserinclude

提问by

Possible Duplicate:
Is there a way to embed a browser in Java?

可能的重复:
有没有办法在 Java 中嵌入浏览器?

how can i embed a web browser within a java application?

如何在 Java 应用程序中嵌入 Web 浏览器?

Thanks, David

谢谢,大卫

回答by Robert Munteanu

You can use SWT for this, here's a simple example.

您可以为此使用 SWT,这是一个简单的示例

回答by Michael Borgwardt

There are a number of alternatives:

有多种选择:

  • JEditorPane- included in the JRE, but only renders simple HTML
  • JDIC- open source, embeds native browser
  • ICEBrowser- commercial, renders the HTML in Java
  • WebRenderer- commercial, embeds native browser in Java

And a few more that don't seem to be under active development.

还有一些似乎没有在积极开发中的。

回答by J-16 SDiZ

If you want pure java solution, try Lobo.

如果您想要纯 Java 解决方案,请尝试Lobo

Otherwise, you may use SWT / JRex or some other JNI-based product.

否则,您可以使用 SWT / JRex 或其他一些基于 JNI 的产品。

回答by willcodejavaforfood

I got another one

我还有一个

The Lobo Project- Open Source

Lobo 项目- 开源

回答by Geo

You can use mozswing. It works.

您可以使用mozswing。有用。

回答by adrian.tarau

Flying Sauceris small and renders pretty well regularHTML pages

Flying Saucer很小并且可以很好地呈现常规HTML 页面

回答by Horcrux7

If you need a pure Java solution then you can use JWebEngine. Its the best pure Java solution currently available.

如果您需要纯 Java 解决方案,那么您可以使用JWebEngine。它是目前可用的最好的纯 Java 解决方案。

回答by Christopher Deckers

You could also try the JWebBrowser from DJ Native Swing: http://djproject.sourceforge.net/ns

您也可以尝试来自 DJ Native Swing 的 JWebBrowser:http://djproject.sourceforge.net/ns