Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using JTextPane for html

 
Barry Brashear
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am attempting to using a JTextPane to view html. I am getting the html from a string. Is this how you do it? The frame stuff is left out.

JTextPane textPane = new JTextPane();
textPane.setContentType("text/html");
textPane.setEditable(false);

textPane.setText( " some html string );

Thanks!
 
Dave Wingate
Ranch Hand
Posts: 262
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not use JEditorPane? From Sun's tutorial:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic