|
package telephonequery;
import javax.microedition.midlet.*; import javax.microedition.lcdui.*; import java.io.*; import javax.microedition.lcdui.Command; import javax.microedition.lcdui.Displayable;
public class TelephoneQuery extends MIDlet implements CommandListener { private Display aDisplay; private Command exitCommand; private TextBox aTextBox; private List aList; private Alert anAlert;
private Image aImage; private Image bImage; private Image cImage;
public TelephoneQuery() { aDisplay = Display.getDisplay(this); }
protected void startApp() { try { aImage = Image.createImage("/PushPuzzle.png"); bImage = Image.createImage("/TilePuzzle.png"); cImage = Image.createImage("/App.png"); } catch (IOException e) { } Image[]image = {aImage,bImage,cImage};
String[]menu = {"网络查询","本地查询","关于"}; //定义一个IMPLICIT List aList = new List("手机移动查询系统",List.IMPLICIT,menu,image);
//添加事件处理程序 exitCommand = new Command("退出",Command.SCREEN,1); aList.addCommand(exitCommand); aList.setCommandListener(this);
aDisplay.setCurrent(aList); }
protected void pauseApp() { }
protected void destroyApp(boolean boolean0) { }
public void commandAction(Command c, Displayable d) { if(c == exitCommand){ destroyApp(false); notifyDestroyed(); } else{ switch(aList.getSelectedIndex()){ case 0: anAlert = new Alert("谢谢使用", "手机移动查询系统\n还没有完成本地搜索!!", null, AlertType.INFO); anAlert.setTimeout(Alert.FOREVER); aDisplay.setCurrent(anAlert); break; case 1: anAlert = new Alert("谢谢使用", "手机移动查询系统\n还没有完成网络查询!!", null, AlertType.INFO); anAlert.setTimeout(Alert.FOREVER); aDisplay.setCurrent(anAlert); break; case 2: anAlert = new Alert("关于", "手机移动查询系统\n开发人员:Andy\n版权所有@深圳职业技术学院", null, AlertType.INFO); anAlert.setTimeout(Alert.FOREVER); aDisplay.setCurrent(anAlert); break; } } } }
|
|