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

📄 mainmidlet.java

📁 J2ME下一个还算简单的电话本功能代码 测试通过 可以运行
💻 JAVA
字号:
import javax.microedition.lcdui.Choice;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.List;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.microedition.rms.RecordStore;

public class MainMIDlet extends MIDlet implements CommandListener {

	private final static Command exitCommand = new Command("推出", Command.EXIT,
			1);

	private final static Command confirmCommand = new Command("确认",
			Command.SCREEN, 1);

	private Display display;

	private List mainList;

	private RecordStore rs;

	public MainMIDlet() {
		super();
		display = this.display.getDisplay(this);
		// TODO Auto-generated constructor stub
	}

	protected void startApp() throws MIDletStateChangeException {

		Image[] imageArray = null;
		try {
			Image icon = Image.createImage("/pic/choose.png");
			imageArray = new Image[] { icon, icon, icon, icon };

		} catch (java.io.IOException e) {
			imageArray = null;
		}
		String[] StringArray ={"添加新记录","浏览电话薄","查找记录","删除记录"};
		mainList = new List("电话本",Choice.IMPLICIT,StringArray,imageArray);
		mainList.addCommand(exitCommand);
		mainList.addCommand(confirmCommand);
		mainList.setCommandListener(this);
		display.setCurrent(mainList);

	}

	protected void pauseApp() {
		// TODO Auto-generated method stub

	}

	protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
		// TODO Auto-generated method stub

	}

	public void commandAction(Command arg0, Displayable arg1) {
		// TODO Auto-generated method stub

	}

}

⌨️ 快捷键说明

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