JTextArea Class
Package: javax.swing
The JTextArea
class creates a text area, which is similar to a text field, but it lets the user enter more than one line of text. If the user enters more text in the text area than can be displayed at once, the text area can display a scroll bar to allow the user to see the entire text. Figure 5-12 shows a text area in action.
Figure 5-12
Constructors
Constructor |
Description |
|
Creates a new text area |
|
Creates a new text area large enough to display the specified number of rows and columns |
|
Creates a new text area with the specified initial text value, large enough to display the specified number of rows and columns |
Methods
Method |
Description |
|
Adds the specified text to the end of the text area’s text value. |
|
Gets the number of lines currently in the text value. |
|
Gets the text value entered in the field. |
|
Inserts the specified text at the specified position. |
Get Java For Dummies Quick Reference 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.