1

i was trying to do some simple text formatting using JEditorPane but then as knowledge grew i found JTextPane easier to implement and more robust.

my query is how do i save the formatted text in JTextPane to file? it should be RTF or HTML or other.. as this file is not opened by the application again.

it is a chat history text file with formatted text.

thank you.

3
  • Cross posted in at least 3 other forums: forums.sun.com/thread.jspa?threadID=5437282&tstart=0. Apparently the answer given here is too complicated, yet I see no follow up question. Commented Apr 27, 2010 at 19:05
  • thats because i havent made much progress with regards to understanding the solution contributed. Commented Apr 27, 2010 at 20:21
  • @camickr: hopefully no bad feelings. it took too much chaos to get to the answer this time. Commented Apr 27, 2010 at 21:59

1 Answer 1

2

You have write method for HTML and RTF from StyledEditorKit. See HTMLEditorKit.write and RTFEditorKit

Sign up to request clarification or add additional context in comments.

1 Comment

thanks it took really long this time around to understand the issue but glad it worked out. now have a working demo. :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.