106187280152001f185d87389a1c119f
上传用户:anders
上传日期:2022-07-15
资源大小:376k
文件大小:1k
源码类别:

J2ME

开发平台:

Java

  1. package phoneLeter;
  2. import javax.microedition.lcdui.Command;
  3. import javax.microedition.lcdui.CommandListener;
  4. import javax.microedition.lcdui.Displayable;
  5. import javax.microedition.lcdui.Form;
  6. import javax.microedition.lcdui.TextField;
  7. public class addPhone extends Form implements CommandListener {
  8. private Command cmdOk=new Command("确定添加",Command.OK,1);
  9. private Command cmdBack=new Command("返回",Command.BACK,1);
  10. private phoneMIDlet pm;
  11. private TextField tfName=new TextField("请输入姓名","",10,TextField.ANY);
  12. private TextField tfPhone=new TextField("请输入密码","",10,TextField.PHONENUMBER);
  13. public addPhone(phoneMIDlet pm)
  14. {
  15. super("添加电话号码");
  16. this.pm=pm;
  17. this.addCommand(cmdOk);
  18. this.addCommand(cmdBack);
  19. this.setCommandListener(this);
  20. this.append(tfName);
  21. this.append(tfPhone);
  22. }
  23. public void commandAction(Command arg0, Displayable arg1) {
  24. if(arg0==cmdOk)
  25. {
  26. //添加电话界面,并返回通讯录界面
  27. //.....添加电话
  28. pm.changeInterface("phoneList");
  29. }
  30. else if(arg0==cmdBack)
  31. {
  32. //返回电话本界面
  33. pm.changeInterface("phoneList");
  34. }
  35. }
  36. }