Create JTextArea - Java Swing

Java examples for Swing:JTextArea

Introduction

JTextArea can handle multiline plain text.

Create a blank JTextArea

import javax.swing.JTextArea;

public class Main {

  public static void main(String[] args) {
    JTextArea emptyTextArea = new JTextArea();
  }
}

Create a JTextArea with 10 rows and 50 columns

import javax.swing.JTextArea;

public class Main {

  public static void main(String[] args) {
    JTextArea commentsTextArea = new JTextArea(10, 50);
  }
}

Create a JTextArea with 10 rows and 50 columns with an initial text of "Enter resume here"

import javax.swing.JTextArea;

public class Main {

  public static void main(String[] args) {
    JTextArea a = new JTextArea("Enter", 10, 50);
  }
}

Related Tutorials