在Java中添加Web浏览器中的一个JFrame / JPanel的/的JComponent [英] Adding a Web Browser in a JFrame/JPanel/JComponent in Java

查看:1182
本文介绍了在Java中添加Web浏览器中的一个JFrame / JPanel的/的JComponent的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我这样做,需要使用Web浏览器的应用程序中的Java应用程序。

I'm doing a Java application that requires to use a web browser inside the application.

我已经看到了一些应用程序这样做,比如在左边的面板中饲料点击并在同一应用程序中打开在右侧面板中的链接时,RSS阅读器,我想实现类似的东西。

I have seen some applications doing this, such as RSS readers when clicking in a feed in the left panel and opening the link in a right panel in the same application, and I would like to implement something similar.

是否有可能做到这一点在Java中?有没有包含在Java API中的图书馆吗?我是否需要外部库?任何信息? IE,火狐,Chrome,歌剧?我应该怎么使用?

Is it possible to do this in java? Is there any library included in the Java API? Do I need external libraries? Any information? IE, Firefox, Chrome, Opera? What should I use?

在此先感谢

推荐答案

这是每个人都避免了明显的是JEditorPane中这是正确的挥杆。这是一个猪,非常有限的,但对于某些类型的HTML渲染它确定。

The obvious one that everyone is avoiding is JEditorPane which is right in swing. It's a pig and very limited but for certain types of HTML rendering it does ok.

我已经用了简单的工作。

I have used it for simpler jobs.

由于在其他环节中提到,路宝浏览器是另一种选择。在眼镜蛇东西是pretty好,处理比JEditorPane中更大量的网页。我发现它所有的媒体工作,但有其设计的一些令人沮丧的unextensible部分。我用它为我的帮助系统和一些非AJAX的web繁重的工作。

As mentioned in the other links, Lobo Browser is another option. The cobra stuff in that is pretty good and handles a lot more pages than JEditorPane. I found it does all of my medium jobs but has some frustratingly unextensible parts of its design. I use it for my help systems and some non-AJAX heavy web work.

对于像谷歌地图什么,那些五花八门的重AJAX风格的Web应用程序,你是pretty太多套牢DJ原住民作为另一个海报和其他问题的回答不在话下。由于它是炮击了一个真正的浏览器在幕后将处理任何网站。唯一的缺点是你失去控制权它在做什么一定的水平,因为你必须使通过Java脚本调用它,并获取事件回到通过类似的机制。

For anything like google maps, and those sorts of heavy AJAX style web applications, you are pretty much stuck with DJ Native as another poster and the other question responses mention. Since it's shelling out to a real browser underneath the covers it will handle any web site. The only down side is that you lose a certain level of control over what it's doing since you have to make calls to it through Java script and get events back through a similar mechanism.

作为一个例子任何理智的人都需要的,我有这样的渲染Swing控件(报告等)右转进入动态网页应用程序。在JEditorPane中,这是混淆,但可能的。在眼镜蛇这几乎是容易的,但一些私人或最终需要方法的变通。在DJ本土,就不可能不提前产生了时间的图像,使通过URL使用它(本地或远程)。

As an example no sane person would need, I've had applications that rendered swing controls (reports, etc.) right into the web page on the fly. In JEditorPane this was confounding but possible. In Cobra it's almost easy but a few private or final methods requiring work-arounds. In DJ Native, it would be impossible without generating the image ahead of time and making it available via URL (either local or remote).

因此​​,一切都取决于你的需要。对于免费的,没有完美的解决方案。

So it all depends on your needs. For free, there is no perfect solution.

这篇关于在Java中添加Web浏览器中的一个JFrame / JPanel的/的JComponent的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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