A TextArea is a mult-line TextField. |
Like TextFields, you can use the methods getText and setText on TextAreas. |
Unlike TextFields, TextAreas do not generate ActionEvents, since pressing enter inserts a newline into the text (i.e. the cursor goes to the next line). |
When writing Strings into a TextArea with the setText method, you must explicitly put newlines into the String to put text on different lines: TextArea ta = new TextArea ( 5, 60 ) ; ta.setText ( "The first line, \n the second line." ) ; |
The TextArea above is created with room for 5 lines of text, each of 60 characters long. |