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 JTextFields, JTextAreas and several other text-based GUI components.
The application in Figs. 12.47–12.48 demonstrates JTextAreas. 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 JTextFields, JTextAreas 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 JLists (Section 12.13), an external event from another GUI component indicates when to process ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access