Slide 3.17: Lists (cont.) Slide 3.19: Other interfaces Home |
Form form = new Form("Form for Stuff");
Form
.
form.append(gauge);
form.append(textfield);
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 );
Form
.
DateField
object with the following parameters:
label
— the item label.
mode
— the input mode, one of the following three modes:
DATE
— allows to set only date information.
TIME
— allows to set only time information (hours, minutes).
DATE_TIME
— allows to set both clock time and date values.
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.