SpringGUI

introduction    download    reference    examples    faq


Reference

Name

getText(), setText()

Examples

// Set the text on a Button to the text in a TextField...
void handleEvent(String[] parameters) {
  // if the TextField named "myTextField" is changed,
  if ( parameters[1].equals("myTextField") && parameters[2].equals("textChanged") ) {
    String txt = gui.getText("myTextField");
    // change the text on the Button "myButton".
    gui.setText("myButton", txt);
  }
}

Description

getText returns the text on a Button, TextField, TextArea, Checkbox or Radiobutton.
setText sets this attribute.

Syntax

String text = gui.getText(name);
and
gui.setText(name, text);

Parameters

String name The name of the element.
String text The new text for the element (in case of setText()).

Returns

getText():
The text of an element if it can be found and is of type Button, TextField, TextArea, Checkbox or Radiobutton. Otherwise null.
setText():
true if the element can be found and is of a type that has text to be set.

Related

for Choice and List, use:
addItem()
hasItem()
selectItem()


back to the top of the page


tinkering with codetools and docsscrapbookabout