How to Create Text Area In Java
In this section, you will learn how to create Text Area in Java. This section provides you a complete code of the program for illustrating the topic.
Here, a class "TextAreaExample" has been defined. This class has main method in which frame and a panel are created and a text area is also created on the panel by using JTextArea class and it's constructor of java.swing package. In the code of the example, constructor of the JTextArea has been used with three arguments. These arguments are as follows:
- First parameter is string that is for the value of the Text Area component.
- Second one is a integer value i.e. for the number of rows of the text area component.
- And last one is also a integer type value that is for number of columns of the Text Area component.
Here is the code of this program:
Output this program: