How to select all text in JTextArea?
Selecting all text in the
JTextArea component can be done by using the
selectAll() method. In the example below we use a button action to do the selection. After select the text we transfer focus back to the
JTextArea so that the highlighted text is shown.