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

📄 stopwatchmain.java

📁 是基于J2ME的一个模拟手机的界面可以实现手机收发短信基于客户端和服务器端的功能
💻 JAVA
字号:
package phone.function.secondWatch;

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

import phone.MainMIDlet;
import phone.function.list.FunctionList;

public class StopwatchMain extends Form implements CommandListener {
	/**
	 * @author Hou Liang Wei
	 * @deprecated 创建了一个Form表单的对象form;按钮Command的对象exit表示推出整个程序, ok进入秒表的界面,
	 *             exitWatch退出秒表的界面, start启动秒表, stop停止秒表
	 * @see time:2009-3-4-16:43
	 */
	private Display display;

	private Command back, ok, exitWatch, start, stop;

	private Watch watch;

	private FunctionList fl;

	public StopwatchMain(FunctionList fl, Display display) {

		super("秒表");
		this.display = display;
		this.fl = fl;
		back = new Command("back", Command.EXIT, 1);

		ok = new Command("ok", Command.OK, 1);

		exitWatch = new Command("exitWatch", Command.CANCEL, 1);

		start = new Command("start", Command.OK, 1);

		stop = new Command("stop", Command.STOP, 1);

		this.addCommand(back);

		this.addCommand(ok);

		this.setCommandListener(this);

		this.append("争分夺秒");
	}

	/** 实现CommandListener接口中的方法 */
	public void commandAction(Command command, Displayable arg1) {

		if (command == start) {

			watch.removeCommand(start);

			watch.addCommand(stop);

			watch.startWatch();
		}
		if (command == stop) {

			watch.end();

			watch.removeCommand(stop);

			watch.addCommand(start);
		}
		if (command == exitWatch) {

			display.setCurrent(this);
		}
		if (command == back) {
			fl.getList();
		}
		if (command == ok) {

			watch = new Watch();

			watch.addCommand(exitWatch);

			watch.addCommand(start);

			watch.setCommandListener(this);

			display.setCurrent(watch);
		}
	}

}

⌨️ 快捷键说明

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