1

How can I use jEditorPane as jTextArea with the append method in the jTextarea ?

example :

jTextArea.append(mystring);

jEditorPane.?

Hovercraft Full Of Eels
  • 283,665
  • 25
  • 256
  • 373
Arief
  • 25
  • 6
  • 2
    Don't use an editor pane to insert text like you do with a JTextArea. A JEditorPane should be used to insert HTML. Check out the HTMLEditorKit for method to insert HTML. Instead use a JTextPane. You can use the insertString() method and you can specify attributes as you insert text into the Document. – camickr Jun 23 '13 at 22:34

1 Answers1

3

I would take a look at the Document, specifically, the Document#insertString method.

With this you could could do something like...

Document doc = editorPane.getDocument();
doc.insertString(doc.getLength(), "This is the string to insert", null);
MadProgrammer
  • 343,457
  • 22
  • 230
  • 366