?? phonelist.java
字號:
package AdressList;
import java.util.Vector;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.List;
public class PhoneList extends List implements CommandListener{
private Command cmdBack = new Command("返回",Command.BACK,1);
private Command cmdAdd = new Command("添加電話",Command.SCREEN,1);
private Command cmdDel = new Command("刪除電話",Command.SCREEN,1);
private PhoneMIDlet pm;
public PhoneList(PhoneMIDlet pm){
super("電話本",List.IMPLICIT);
this.pm = pm;
this.addCommand(cmdBack);
this.addCommand(cmdAdd);
this.addCommand(cmdDel);
this.setCommandListener(this);
}
public void commandAction(Command c,Displayable d){
if(c==cmdBack){//返回歡迎界面
pm.changeInterface("WelcomeCanvas");
}
else if(c==cmdAdd){
pm.changeInterface("AddForm");
}
else if(c==cmdDel){
//刪除紀錄...
this.delete();
pm.changeInterface("PhoneList");//更新
}
}
/*載入所有電話*/
public void loadPhones(){
RMSOpe rmsope = new RMSOpe("PhoneStore");
rmsope.openRecordStore();
Vector v = rmsope.getAllPhone();
for(int i=0;i<v.size();i++){
this.append((String)v.elementAt(i), null);
}
rmsope.closeRecordStore();
}
/*刪除電話*/
public void delete(){
RMSOpe rmsope = new RMSOpe("PhoneStore");
rmsope.openRecordStore();
rmsope.deletePhone(this.getString(this.getSelectedIndex()));
rmsope.closeRecordStore();
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -