addPhone.java
上传用户:anders
上传日期:2022-07-15
资源大小:376k
文件大小:1k
- package phoneLeter;
- import javax.microedition.lcdui.Command;
- import javax.microedition.lcdui.CommandListener;
- import javax.microedition.lcdui.Displayable;
- import javax.microedition.lcdui.Form;
- import javax.microedition.lcdui.TextField;
- public class addPhone extends Form implements CommandListener {
- private Command cmdOk=new Command("确定添加",Command.OK,1);
- private Command cmdBack=new Command("返回",Command.BACK,1);
- private phoneMIDlet pm;
- private TextField tfName=new TextField("请输入姓名","",10,TextField.ANY);
- private TextField tfPhone=new TextField("请输入密码","",10,TextField.PHONENUMBER);
-
- public addPhone(phoneMIDlet pm)
- {
- super("添加电话号码");
- this.pm=pm;
- this.addCommand(cmdOk);
- this.addCommand(cmdBack);
- this.setCommandListener(this);
-
- this.append(tfName);
- this.append(tfPhone);
- }
- public void commandAction(Command arg0, Displayable arg1) {
- if(arg0==cmdOk)
- {
- //添加电话界面,并返回通讯录界面
- //.....添加电话
- this.addPhoneNum();
- pm.changeInterface("phoneList");
- }
- else if(arg0==cmdBack)
- {
- //返回电话本界面
- pm.changeInterface("phoneList");
- }
- }
-
- public void addPhoneNum()
- {
- RMSope rmsope=new RMSope("PhoneStore");
- rmsope.openRecordStore();
- rmsope.addPhone(tfName.getString(),tfPhone.getString());
- rmsope.closeRecordStore();
- }
- }