Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
355 views
in Technique[技术] by (71.8m points)

java - jEditorPane as a web browser

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::

  1. The browser is not displaying the java script.
  2. It is not displaying the Applet.
  3. Brows data does not show in proper way(like as a browser(Show in imagealt text)).

My code is-

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);
  }
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...