📄 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);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -