?? checkoperate.java
字號:
package shipwar;
import javax.microedition.lcdui.*;
import javax.microedition.rms.*;
public class CheckOperate extends Alert implements CommandListener{
private Command Ensure=new Command("確定",Command.ITEM,1);
private Command Return=new Command("返回",Command.EXIT,5);
private Displayable upinstance,up2instance;
public CheckOperate(Displayable upinstance,Displayable up2instance){
super("提示信息");
this.setString("確定要清空記錄?");
this.setTimeout(Alert.FOREVER);
this.upinstance=upinstance;
this.up2instance=up2instance;
this.addCommand(Ensure);
this.addCommand(Return);
this.setCommandListener(this);
}
public void commandAction(Command c,Displayable d){
if(c==Return)
Display.getDisplay(shipwarMIDlet.shipwarmidlet).setCurrent(upinstance);
else if(c==Ensure){
NameComparator namecom=new NameComparator();
RecordEnumeration re=null;
try{
re=MainMenu.rs.enumerateRecords(null,namecom,true);
int id;
while(re.hasNextElement()){
id=re.nextRecordId();
MainMenu.rs.deleteRecord(id);
}
}catch(Exception e){
System.out.println("全部刪除出錯");
}
Alert a=new Alert("提示信息");
a.setString("清除記錄成功");
a.setTimeout(2000);
Display.getDisplay(shipwarMIDlet.shipwarmidlet).setCurrent(a,up2instance);
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -