MDIP中ALERT的问题(使用JB7+MOBILESET3)
/**Component initialization*/
private void jbInit() throws Exception {
// set up this Displayable to listen to command events
alert1 = new Alert("");
alert1.setTitle("Error");
alert1.setString("Press any key to continue");
alert1.setType(AlertType.ERROR);
setCommandListener(this);
// add the Exit command
addCommand(new Command("Exit", Command.EXIT, 1));
addCommand(new Command("Alert", Command.SCREEN, 1));
}
/**Handle command events*/
public void commandAction(Command command, Displayable displayable) {
/** @todo Add command handling code */
if (command.getCommandType() == Command.EXIT) {
// stop the MIDlet
MIDlet1.quitApp();
}
if (command.getLabel()=="Alert"){
Display.getDisplay(this).setCurrent(alert1);
//这句该怎么写呢,我用MIDlet1.instance也不行?
}
}
}