TextArea

TextArea objects are used for entering text that may span several lines.

Function Description
TextArea(text, rows, columns) Creates a text area containing the given text (string) with the given rows (default 5) and columns (default 400.  If the text exceeds the text area dimensions, a slider bar will appear on the right.

Once a TextArea has been created, it may be added to a Display specifying where to place its top-left corner.

d.add(textarea1, 50, 50)

A TextArea is a passive GUI element.  You can access its contents with the following functions:

Function Description
textArea.getText() Returns the text contained in the text area (a string).
textArea.setText() Sets the text contained in the text area (a string).
textArea.setFont() Changes the font used in the text area,e.g., Font(“Dialog”, Font.PLAIN, 12), or Font(“Serif”, Font.ITALIC, 16).