Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTML in JTextPane/Editor

 
cardwell cupp
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Cardwell
 
vicky bawge
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you thought of using JEditorPane.
Have you tried to invoke setContentType("text/html")
Vicky
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic