rsdeletion.java

来自「jBuilderX无线应用开发源代码」· Java 代码 · 共 41 行

JAVA
41
字号
import javax.microedition.midlet.*;
import javax.microedition.rms.*;
import javax.microedition.lcdui.*;

public class RSDeletion extends MIDlet implements CommandListener{
    private Display display;
    private TextBox t;
    private Command exit;
    
    public RSDeletion () {
        display = Display.getDisplay(this);
        t = new TextBox("Delete RMS","Record store deleted. ", 256,0);
        exit = new Command("exit", Command.EXIT, 2);
        t.addCommand(exit);
        t.setCommandListener(this);
    }
    
    public void startApp() {
        try {
            //删除记录存储myRecordStore
            RecordStore.deleteRecordStore("myRecordStore");
            display.setCurrent(t);
            }catch(Exception e){
                //捕获异常RecordStoreException           
                System.out.println("Error: " + e.getMessage());
            }
    }
        
    public void pauseApp(){
    }
    
    public void destroyApp(boolean unconditional){
    }
    
    public void commandAction(Command c, Displayable s) {
        if(c == exit) {
            destroyApp(false);
            notifyDestroyed();
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?