📄 listrecord.java
字号:
package PhoneBook;
import javax.microedition.midlet.MIDlet;
import javax.microedition.lcdui.*;
import javax.microedition.rms.*;
public class ListRecord extends List implements CommandListener {
private Displayable dis;
private MIDlet mid ;
private RecordStore rs =null;
private RecordEnumeration re =null;
private static final Command lookCommand=new Command ("查看",Command.OK,1);
private static final Command backCommand=new Command("返回",Command.BACK,2);
public ListRecord(String title,int listType,Displayable dis ,MIDlet mid ,RecordStore rs){
super(title ,listType);
this.dis=dis;
this.mid=mid;
this.rs=rs;
this.addCommand(backCommand);
this.addCommand(lookCommand);
this.setCommandListener(this);
SortComparator sortCom=new SortComparator();
if(rs!=null){
try{
Image icon=Image.createImage("/txt.png");
re=rs.enumerateRecords(null, sortCom,true);
while(re.hasNextElement()){
BookAccount account=BookAccount.deserialize(re.nextRecord());
int index=this.append(account.getUserName(),icon);
}
}catch (Exception e){
}finally{
if(re!=null)
re.destroy();
}
}
}
public void commandAction(Command c ,Displayable d){
if(c==backCommand){
Display.getDisplay(mid).setCurrent(dis);
}
if(c==lookCommand){
EditDetailInfo edInfo=new EditDetailInfo("查看和修改记录",this ,mid,rs,this.getString(this.getSelectedIndex()));
Display.getDisplay(mid).setCurrent(edInfo);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -