permaculture playing cards
The moose likes Swing / AWT / SWT and the fly likes JEditorPane - content text/html problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JEditorPane - content text/html problem" Watch "JEditorPane - content text/html problem" New topic

JEditorPane - content text/html problem

Wolfgang Tintemann
Ranch Hand

Joined: Sep 11, 2010
Posts: 65

In the API of JEditorPane I read the following :

By default, the following types of content are known:
text/plain Plain text, which is the default the type given isn't recognized. The kit used in this case is an extension of DefaultEditorKit that produces a wrapped plain text view.
text/html HTML text. The kit used in this case is the class javax.swing.text.html.HTMLEditorKit which provides HTML 3.2 support.
text/rtf RTF text. The kit used in this case is the class javax.swing.text.rtf.RTFEditorKit which provides a limited support of the Rich Text Format.

Does that mean that I cant show e. g. HTML 4.01 pages in the pane ?

At least when I try to show such a ( very simple, only basic html tags ) page in the pane I get a null pointer exception dealing with so called Glyphs (?).
When I show a plain text in my applet panel all works fine.

What happens here ?

Time isn't Money, Money is Time.
The man who works looses his time ( spanish proverb )
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

No. It means that you can display anything which conforms to HTML 3.2. The editor may well be able to display pages which are declared as HTML 4.01 if they do in fact conform to HTML 3.2.
I agree. Here's the link:
subject: JEditorPane - content text/html problem
It's not a secret anymore!