⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rscreation.java

📁 jBuilderX无线应用开发源代码
💻 JAVA
字号:
import javax.microedition.midlet.*;
import javax.microedition.rms.*;
import javax.microedition.lcdui.*;

public class RSCreation extends MIDlet implements CommandListener{
	//声明一个RecordStore对象
	private RecordStore rs;
	private Display display;
	private TextBox t;
	private Command exit;
	
	public RSCreation () {
	    //将rs初始化为null
	    rs = null;
	    display = Display.getDisplay(this);
	    t = new TextBox("Create RMS","Record store is created. ", 256,0);
	    exit = new Command("exit", Command.EXIT, 2);
	    t.addCommand(exit);
	    t.setCommandListener(this);
	}
	
	public void startApp() {
		try {
		    //使用第一个方法创建记录存储myRecordStore
		    	rs = RecordStore.openRecordStore("myRecordStore", true);
    			display.setCurrent(t);
    		}catch(Exception e){
             //捕获异常RecordStoreException  		 
    		    System.out.println("Error: " + e.getMessage());
    		}finally{
    		//关闭记录存储
    		try{
    			rs.closeRecordStore();
    		}catch(Exception e){
    		    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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -