by Dinesh Thakur Category: AWT and Applets

The TextArea component is similar to the TextField component except that it allows to display and edit multiple lines of plaintext. The TextArea component has certain number of rows and columns that determines its size. If all the text cannot be displayed in the available space in the component, even then scrollbars are not automatically added. In order to add scrollbars, you must insert it into a Scrollpane.

import java.awt.*;

class TextAreaExample extends Frame
          setLayout(new FlowLayout());
          Label label = new Label("Comment Box");
          TextArea txtArea = new TextArea("TextArea",3,15); //TextArea with 3 rows and 15 columms
   class TextAreaJavaExample
         public static void main(String args[])
               TextAreaExample frame = new TextAreaExample();
               frame.setTitle("TextArea in Java Example");

TextArea in Java Example

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.

Related Articles