Java Swing How to - Append some text to JTextArea








Question

We would like to know how to append some text to JTextArea.

Answer

// w w w . j  av  a  2 s  . c  o  m


import javax.swing.JTextArea;

public class Main {
  public static void main(String[] argv) {
    JTextArea ta = new JTextArea("Initial Text");
    ta.append("some text");

  }
}