How to use the Swing text area control on a form.
You can run this technique code from:
NOTE First make sure that database is running on your localhost SilverStream Server | |
See the chapter on the Form Designer in the Tools Guide |

The following code uses getText() to get the text from the text area taEnterText, and then uses setText() to place the text in taTextArea.
This code is in the actionPerformed event of btnSetText.
// Get the text from the data entry text area and put it in
// the target text area, replacing any text already there
taTextArea.setText(taEnterText.getText());
// Clear the data entry text area
taEnterText.setText("");
getText() is passed directly to setText().

This code uses getText() to get the text entered in the text field taEnterText, and then uses appendText() to append this string to another string in taTextArea.
This code is in the actionPerformed event of btnAppend.
// Get the text from the data entry text area and append it
// to the text already in the target text area
taTextArea.append(taEnterText.getText());
// Clear the data entry text area
taEnterText.setText("");
getText() is passed directly to appendText().

The following code uses the getSelectedText() method to get text the user selected (highlighted) in the text area taTextArea. It then uses the agDialog.showMessage() method to display the selected text in a standard message box.
This code is in the actionPerformed event of btnSelectedText.
// Get the selected text from the target text area
agDialog.showMessage("taTextArea Selected Text",
taTextArea.getSelectedText());
getSelectedText() passes the string parameter to showMessage().