Lists (Cont.)


Form form = new Form("Form for Stuff");
form.append(gauge);
form.append(textfield);

The method public int javax.microedition.lcdui.Form.append(Item item) adds an Item into the Form. An Item is a superclass for components that can be added to a Form and Alert.

DateField date = new DateField( "Today's date: ", DateField.DATE );
List down = (List) display.getCurrent( );
switch( down.getSelectedIndex( ) ) {
The method public int getSelectedIndex( ) returns the index number of an element in the Choice that is selected. For Choice types EXCLUSIVE and IMPLICIT there is at most one element selected, so this method is useful for determining the user's choice.