File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes HTML in JTextPane/Editor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "HTML in JTextPane/Editor" Watch "HTML in JTextPane/Editor" New topic

HTML in JTextPane/Editor

cardwell cupp
Ranch Hand

Joined: Aug 16, 2001
Posts: 66
Hey guys...I am working on a program that displays html in a JTextPane. When I load a file with setView(someFile), it works just fine, but if I just do setText(), I get the html as plain text. I don't want to have to write the html to a file just to make it work. Any suggestions/solutions?
Thanks All
vicky bawge
Ranch Hand

Joined: Sep 04, 2001
Posts: 34
Have you thought of using JEditorPane.
Have you tried to invoke setContentType("text/html")
wood burning stoves
subject: HTML in JTextPane/Editor