Question

Is it possible to make a JEditorPane understand more advanced HTML and CSS?
I mean, when you enter HTML or CSS such as <button>, <progress>, or most other tags, it does not understand them. Is there any way to make it understand and display more complex and advanced coding? If it is, how would I do it?
Thanks!

Was it helpful?

Solution

Yes. Java 7 EE has HTML5 functionality although I'm not sure about specific tags. Also, there are external packages, like one from Intel freely available and you can always extend the functionality yourself in some way or another.

Edit: addendum to my 2nd suggestion (implementing the topic in the linked question)

The Intel JWebEngine (which might be what you are already looking for) documentation says:

What are the advantages versus the built-in Java HTML editor?

The built-in Java HTML editor of Java is very limited. It only supports HTML 3.2 with some features of HTML 4 and CSS. The support of CSS is wrong in many cases, especially when it comes to cascading selectors. The text is often too small and on many web sites Java only shows an error instead of a incorrectly formatted page.

Here are some further differences:

  • JWebEngine can display the ACID 1 test correctly - Java does not
  • JWebEngine can display the ACID 2 test partly - Java only displays a blank page because an error occurs
  • JWebEngine basically shows HTML pages like a browser with JavaScript disabled
  • In cases where the CSS and HTML specifications are not explicit about implementation JWebEngine is designed to mirror Mozilla FireFox's behavior.

OTHER TIPS

No it just understands basic HTML 4. You could use a JavaFx WebView inside a JFXPanel

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top