Methods Summary |
---|
public void | commandAction(Command c, Displayable d)Handle events.
String label = c.getLabel();
if (label.equals("Exit")) {
destroyApp(true);
} else if (label.equals("Back")) {
if(currentMenu.equals("item1") || currentMenu.equals("item2") ||
currentMenu.equals("item3") || currentMenu.equals("item4")) {
// go back to menu
mainMenu();
}
} else {
List down = (List)display.getCurrent();
switch(down.getSelectedIndex()) {
case 0: testItem1();break;
case 1: testItem2();break;
case 2: testItem3();break;
case 3: testItem4();break;
}
}
|
public void | destroyApp(boolean unconditional)
notifyDestroyed();
|
void | mainMenu()
display.setCurrent(menu);
currentMenu = "Main";
|
public void | pauseApp()
display = null;
menu = null;
input = null;
|
public void | prepare()a generic method that will be called when selected any of
the items on the list.
input = new TextBox("Enter some text: ", "", 5, TextField.ANY);
input.addCommand(backCommand);
input.setCommandListener(this);
input.setString("");
display.setCurrent(input);
|
public void | startApp()Start the MIDlet by creating a list of items and associating the
exit command with it.
display = Display.getDisplay(this);
menu = new List("Menu Items", Choice.IMPLICIT);
menu.append("Item1", null);
menu.append("Item2", null);
menu.append("Item3", null);
menu.append("Item4", null);
menu.addCommand(exitCommand);
menu.setCommandListener(this);
mainMenu();
|
public void | testItem1()Test item1.
prepare();
currentMenu = "item1";
|
public void | testItem2()Test item2.
prepare();
currentMenu = "item2";
|
public void | testItem3()Test item3.
prepare();
currentMenu = "item3";
|
public void | testItem4()Test item4.
prepare();
currentMenu = "item4";
|