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

📄 rmsdemomidp.java

📁 这是我在用J2ME Wireless Toolkit编写的一个手机存储功能
💻 JAVA
字号:
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.rms.*;
import java.io.*;

public class RmsDemoMidp extends MIDlet implements CommandListener{
	TextBox textBox;
	Command preCommand,nextCommand,newCommand,exitCommand,menuCommand;

	Form form;
	Display display;
	int currentid = 1;
	String text;
	RecordStore myRecord = null;
	byte[] myBytes;
	List list;




	public void startApp()
	{
	 display = Display.getDisplay(this);
	 menuCommand = new Command("Menu",Command.SCREEN,1);
	 textBox = new TextBox("Diary-Day"+currentid,"",30,TextField.ANY);
	 textBox.addCommand(menuCommand);
	 textBox.setCommandListener(this);
	 display.setCurrent(textBox);
	}

	public void pauseApp(){}

	public void destroyApp(boolean unconditional) 
	{

	}

	public void commandAction(Command c,Displayable d) //throws RecordStoreException
	{
	 if(c==menuCommand)
		{
     list = new List("Menu",Choice.IMPLICIT);		 
     preCommand= new Command("Prev", Command.ITEM, 1);
     nextCommand= new Command("Next", Command.ITEM, 2);
     newCommand= new Command("New", Command.ITEM, 3);
     exitCommand= new Command("Exit", Command.ITEM, 4);
     list.setSelectCommand(preCommand);
     list.addCommand(nextCommand);
     list.addCommand(newCommand);
     list.addCommand(exitCommand);
     list.setCommandListener(this);   
		 display.setCurrent(list);


  


		}
	 else if(c==preCommand)
		{
		 form = new Form("");
		 form.append("Menu");
		 display.setCurrent(form);
		}
	 else if(c==nextCommand)
		{
		 form = new Form("");
		 form.append("Menu");
		 display.setCurrent(form);
		}
	 else if(c==newCommand)
		{
		 form = new Form("");
		 form.append("Menu");
		 display.setCurrent(form);
		}
	 else if(c==exitCommand)
		{
		 destroyApp(true);
		 notifyDestroyed();
		}

//	 myRecord.addRecord(myBytes,0,30);
//	 currentid+=1;
//	 myRecord.closeRecordStore();
	
	}
	
	public String loadEntry(int newld) throws RecordStoreException 
	{
	 return text;
	}

	public void saveEntry(String entry) throws RecordStoreException{}
}

⌨️ 快捷键说明

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