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

📄 controller.java

📁 J2ME的源码!我以前学习J2ME的源码哈!非常适合初学者
💻 JAVA
字号:
package flow2;

import java.util.Timer;
import java.util.TimerTask;

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.Form;
import javax.microedition.lcdui.List;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;

public class Controller extends MIDlet implements CommandListener {

	private Display display;

	private List main;

	Command setCmd = new Command("确定", Command.OK, 4);

	public Controller() {
		main = new List("通讯录", Choice.EXCLUSIVE);
		main.append("添加联系人", null);
		main.append("浏览通讯录", null);
		main.append("查找联系人", null);
		main.append("删除联系人", null);
		main.addCommand(setCmd);
		main.setCommandListener(this);

		display = Display.getDisplay(this);
		display.setCurrent(main);

	}

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

	}

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

	}

	protected void startApp() throws MIDletStateChangeException {

	}

	public void commandAction(Command c, Displayable arg1) {

		if (main.getSelectedIndex() == 0) {// 返回一个值到第几个界面,0为第一个界面;
			display.setCurrent(new Addfriends(display, main));// 这里是调用这两个值;
		} else if (main.getSelectedIndex() == 1) {
			display.setCurrent(new AddList(display, main));// 这里是显示到哪个界面,需new
															// 文件名();

		} else if (main.getSelectedIndex() == 2) {
			display.setCurrent(new find(display, main));
		} else if (main.getSelectedIndex() == 3) {
			display.setCurrent(new delet(display, main));
		}

	}

}

⌨️ 快捷键说明

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