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

📄 beeshotmain.java

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

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;

import phone.Game;

public class BeeShotMain extends List implements CommandListener {

	private Game game;

	private Display display;

	private Command cmdOk, cmdBackGame, cmdBack;

	public BeeShotMain(Game game, Display display) {
		super("蜜蜂小游戏", List.IMPLICIT);
		this.display = display;
		this.game = game;

		this.append("开始游戏", null);
		this.append("游戏说明", null);

		cmdOk = new Command("ok", Command.OK, 1);
		cmdBackGame = new Command("cmdBackGame", Command.BACK, 1);
		cmdBack = new Command("返回", Command.BACK, 1);

		this.addCommand(cmdBack);
		this.addCommand(cmdOk);
		this.setCommandListener(this);
	}

	public void show() {
		display.setCurrent(this);
	}

	public void commandAction(Command command, Displayable dis) {
		if (command == cmdBackGame) {
			display.setCurrent(this);
		}
		if (command == cmdOk) {
			int type = this.getSelectedIndex();
			switch (type) {
			case 0:
				MyCanvas mc = new MyCanvas(this);
				Thread th = new Thread(mc);
				th.start();
				mc.addCommand(cmdBackGame);
				mc.setCommandListener(this);
				display.setCurrent(mc);
				break;
			case 1:
				Form form = new Form("游戏说明");
				form.append("经典小游戏");

				form.addCommand(cmdBack);
				form.setCommandListener(this);

				display.setCurrent(form);
			}
		}
		if (command == cmdBack) {
			game.getGame();
		}
	}

}

⌨️ 快捷键说明

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