6

I am trying to create a simple web browser for a project, but I am using JEditorPane to render and display HTML. I have heard that JEditorPane should not be used as a browser component because it does not support anything above HTML3.2 (and even then doesn't display it properly), but I can't seem to find an alternative for HTML5. Can anyone help me? Thanks in advance.

condorcraft110
  • 195
  • 1
  • 2
  • 8

1 Answers1

8

You can use JavaFX-2 Webview. From the JavaFX-2 Adding HTML Content tutorial docs:

The embedded browser component is based on WebKit, an open source web browser engine. It supports Cascading Style Sheets (CSS), JavaScript, Document Object Model (DOM), and HTML5.

For integration of javafx-2 with swing I recommend you to read the Swing and Javafx-2 Interoperability article.

I hope it helped. Cheers

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
Bruno Vieira
  • 3,884
  • 1
  • 23
  • 35
  • Thanks, I will have a look now. Speedy reply! – condorcraft110 Nov 04 '12 at 12:41
  • Added a new tutorial in my edition. By the way, be aware: After beginning to program with JavaFX-2, chances are that you'll never want to program with Swing again ;) – Bruno Vieira Nov 04 '12 at 12:46
  • Btw @condorcraft110, since you are new to StackOverflow: If an answer is correct, please mark as so, otherwise stackoverflow won't ever know that your problem has been solved. Consider up vote answers that were somewhat useful. This helps other users with similar questions to find answers more easily – Bruno Vieira Nov 04 '12 at 13:15
  • what about the memory consumption after integrating JavaFX into Swing, owww @BrunoVieira? – gumuruh Dec 27 '20 at 14:07