Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Displaying document contents

 
Narayanan Jayaraman
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to display the contents of a word document or XML document. What is the best approach for it ? TextArea component or do I need to use JEditorPane for this ?. Thanks
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JTextArea displays plain text, so it wouldn't work with Word documents, but it could display the XML markup (as plain text) fine.

JEditorPane displays styled text... it will display RTF files (but not Word doc files), text, and HTML. It can display XML fine too.
 
Narayanan Jayaraman
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any tips on how to add XML file into JEditorPane ? Thanks
 
Narayanan Jayaraman
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got it to work . Thanks!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic