-
Book Overview & Buying
-
Table Of Contents
Google Web Toolkit 2 Application Development Cookbook
By :
A text field allows the user to input one-line text information to the program. It is one of the most common widgets.
Import the class com.extjs.gxt.ui.client.widget.form.TextField from the GXT library.
Instantiate it as shown:
TextField<String> nameField = new TextField<String>();
Set the required properties. Some examples are as follows:
nameField.setAllowBlank(false);
nameField.setEmptyText("Enter Employee's Full Name");
nameField.setFieldLabel("Full Name");
nameField.setSelectOnFocus(true);
Add the field on the required form or panel.
Instantiating TextField with a String type parameter (within angle bracket as in<String>) allows the user to set and get the value of the TextField as String. If Integer is given as the parameter type, the setValue method of TextField will accept an Integer value as the argument, and the getValue method will return an Integer value.
The setAllowBlank method is used to set whether the field is valid...
Change the font size
Change margin width
Change background colour