?? addform.java
字號:
package AdressList;
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 AddForm extends Form implements CommandListener{
private Command cmdOK = new Command("確定添加",Command.SCREEN,1);
private Command cmdBack = new Command("返回",Command.BACK,1);
private TextField tfName = new TextField("請您輸入姓名","",10,TextField.ANY);
private TextField tfPhone = new TextField("請您輸入電話","",10,TextField.PHONENUMBER);
private PhoneMIDlet pm;
public AddForm(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 c,Displayable d){
if(c==cmdOK){//添加電話,并回到電話本界面
//.....添加電話
this.addPhone();
pm.changeInterface("PhoneList");
}
else if(c==cmdBack){//返回電話本界面
pm.changeInterface("PhoneList");
}
}
/*添加電話*/
public void addPhone(){
RMSOpe rmsope = new RMSOpe("PhoneStore");
rmsope.openRecordStore();
rmsope.addPhone(tfName.getString(), tfPhone.getString());
rmsope.closeRecordStore();
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -