-
Book Overview & Buying
-
Table Of Contents
Google Web Toolkit 2 Application Development Cookbook
By :
A combo box is a combination of a drop-down list and a text field. It allows the user to either select an item from the drop-down list or type a value directly. In this recipe, we are going to create a simple combo box for the department list.
Import the class com.extjs.gxt.ui.client.widget.form.SimpleComboBox.
Create an instance of SimpleComboBox class, as shown in the following code:
SimpleComboBox departmentCombo = new SimpleComboBox();
Add values for the drop-down list as in the following code:
departmentCombo.add("Sales");
departmentCombo.add("Purchase");
departmentCombo.add("Accounts");
departmentCombo.add("Customer Service");
Set the field label and add the combo box on any form, panel, or relevant widget.
Each invoke of the add method with an object as the argument (String object in this case) adds a value to the drop-down list of the combo box. Two methods—setSimpleValue and getSimpleValue are used to select a value programmatically...
Change the font size
Change margin width
Change background colour