How to add text to a textArea instead of replacing it

vamp658 picture vamp658 · Aug 31, 2012 · Viewed 68.9k times · Source

How can I add text to a JTextArea instead of replacing all of it?

I know about setText(String) but other than that I'm a bit lost.

Answer

DadViegas picture DadViegas · Aug 31, 2012

You can use the append method like this:

textArea.append(additionalText);