This discussion is archived
7 Replies Latest reply: May 18, 2012 6:40 AM by 895294 RSS

How to store RTF content from JEditorPane to a String. Not to a file

895294 Newbie
Currently Being Moderated
Hello, I have an application that interacts with a database in MySQL and want to know, how I can store the code that generates the JEditorPane. I have the following:
editor.setContentType("text/rtf");

And when I do a:
editor.getText().toString()
returns me null.

And if I do a:
editor.getDocument().getText(0, editor.getDocument().getLength()).toString()
back what I have written to the editor, but in plain text without the <br> \ par, etc ...


I have read in many forums and I see that you use the RTFEditorKit, but only used to read or write files .rtf and I need to store the code that generates the editor to save it in a DB.

Any ideas or suggestions?

Thank you very much.

Edited by: 892291 on 17-may-2012 12:29

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points