📄 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 + -