12.20 JTextArea
A JTextArea provides an area for manipulating multiple lines of text. Like class JTextField
, JTextArea
is a subclass of JTextComponent
, which declares common methods for JTextField
s, JTextArea
s and several other text-based GUI components.
The application in Figs. 12.47–12.48 demonstrates JTextArea
s. One JTextArea
displays text that the user can select. The other is uneditable by the user and is used to display the text the user selected in the first JTextArea
. Unlike JTextField
s, JTextArea
s do not have action events—when you press Enter while typing in a JTextArea
, the cursor simply moves to the next line. As with multiple-selection JList
s (Section 12.13), an external event from another GUI component indicates when to process ...
Get Java™ How To Program (Early Objects), Tenth 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.