13.20. The TextArea Class

A TextArea is similar to a TextField, except that it can have multiple lines and does not generate action events. Here are some typical examples:

TextArea inputArea = new TextArea(4, 15);
add(inputArea);
TextArea resultsArea = new TextArea("No Results Yet", 2, 10);
resultsArea.setEditable(false);
add(resultsArea);

Constructors

The following five TextArea constructors are available:

public TextArea()

This constructor creates an empty text area with a platform-dependent number of rows and columns and both vertical and horizontal scrollbars. The default size may be very large, so use this constructor with caution if you're not using a layout manager that will size the text area for you.

public TextArea(int rows, int cols) ...

Get Core Web Programming, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.