Java Reference
In-Depth Information
Listing 7-2.
A MIDlet That Demonstrates SimpleItem
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class SimpleItemMIDlet
extends MIDlet
implements CommandListener {
public void startApp() {
Form form = new Form("SimpleItemMIDlet");
form.append(new SimpleItem("SimpleItem"));
Command c = new Command("Exit", Command.EXIT, 0);
form.addCommand(c);
form.setCommandListener(this);
Display.getDisplay(this).setCurrent(form);
}
public void pauseApp() {}
public void destroyApp(boolean unconditional) {}
public void commandAction(Command c, Displayable s) {
if (c.getCommandType() == Command.EXIT)
notifyDestroyed();
}
}
Figure 7-1 shows this MIDlet in action.
Figure 7-1.
A simple custom item
Search WWH ::
Custom Search