import javax.microedition.lcdui.Choice;
import javax.microedition.lcdui.ChoiceGroup;
import javax.microedition.lcdui.DateField;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.Gauge;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.ImageItem;
import javax.microedition.lcdui.StringItem;
import javax.microedition.lcdui.TextField;
import javax.microedition.midlet.MIDlet;
public class J2MEFormDemo extends MIDlet {
Display d;
Form aForm = new Form("Demo Form");
ChoiceGroup aChoiceGroup = new ChoiceGroup("Choose", Choice.EXCLUSIVE, new String[] { "This",
"That" }, null);
DateField aDateField = new DateField(null, DateField.TIME);
Gauge aGauge = new Gauge("Score", true, 10, 1);
StringItem aStringItem = new StringItem(null, "Demo Items");
TextField aTextField = new TextField("Comments", "Your comments here", 20, 0);
ImageItem anImageItem;
Image anImage;
public J2MEFormDemo() {
try {
anImage = Image.createImage("/star.png");
} catch (java.io.IOException ioE) {
System.out.println("Problem reading image");
}
anImageItem = new ImageItem("Demo Image", anImage, ImageItem.LAYOUT_CENTER, "No image");
aForm.append(aStringItem);
aForm.append(aChoiceGroup);
aForm.append(aDateField);
aForm.append(aGauge);
aForm.append(aTextField);
aForm.append(anImageItem);
}
protected void startApp() {
d = Display.getDisplay(this);
d.setCurrent(aForm);
}
protected void pauseApp() {
}
protected void destroyApp(boolean unconditional) {
}
}