jEditorPane作为Web浏览器 [英] jEditorPane as a web browser
问题描述
我正在用Java创建一个Web浏览器。在这个浏览器中,我使用
JEditorPane用于浏览器窗口。我使用setPage(String url)方法
来显示页面。浏览器可以显示页面但有
一些问题如上所述::
I am creating a web browser in Java. In this browser I am using JEditorPane for Browser Window. I am using "setPage(String url)" method to display the page. The browser can display the page but there are some problems which are as mentioned::
- 浏览器没有显示java脚本。
- 它没有显示Applet。
- 浏览数据没有以正确的方式显示(如浏览器(在图像中显示)))。
我的代码是 -
JEditorPane editorPane = new JEditorPane();
String url="http://google.co.in";
editorPane.setEditable(false);
try {
editorPane.setPage(url);
} catch (IOException e) {
System.err.println("Attempted to read a bad URL: " + url);
}
}
推荐答案
JEditorPane有限的HTML和CSS支持。它不支持javascript或applet。它不能用作Web浏览器。 Sun承诺JWebPane更接近浏览器,但它从未发布过。
JEditorPane has limited html and css support. It does not support javascript or applets. It is not intended to be used as a web browser. Sun promised a JWebPane that would be closer to a browser, but it has never been released.
如果您真的愿意在java中实现浏览器,请加入一些开源java浏览器项目,如 Lobo浏览器。这样,您就可以将您的知识应用于正确的方向。没有必要从头开始。
If you are really willing to implement a browser in java, join some open source java browser project like Lobo browser. This way you can apply your knowledge in a right direction. There is no point doing it from scratch.
这篇关于jEditorPane作为Web浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!