📄 menu.java
字号:
package com.linden.pocketbasketball;
import javax.microedition.lcdui.*;
public class Menu extends List implements CommandListener {
private static final String[] str = {"开始游戏", "选择级别", "游戏说明", "关于"};
private TestMidletMIDlet parent;
private Command chooseCommand = new Command("退出", Command.ITEM, 1);
private Command exitCommand = new Command("选择", Command.EXIT, 2);
public Menu(TestMidletMIDlet parent) {
super("主菜单", List.IMPLICIT, str, null);
addCommand(chooseCommand);
addCommand(exitCommand);
setCommandListener(this);
this.parent = parent;
}
public void commandAction(Command c, Displayable d) {
if (c == chooseCommand) {
parent.exitMIDlet();
}
else if (c == exitCommand) {
if (this.getString(this.getSelectedIndex()) == "开始游戏") {
parent.setCurrent("MainScreen");
}
else if (this.getString(this.getSelectedIndex()) == "关于") {
parent.setCurrent("AboutForm");
}
else if (this.getString(this.getSelectedIndex()) == "游戏说明") {
parent.setCurrent("InstructionsForm");
}
else if (this.getString(this.getSelectedIndex()) == "选择级别") {
parent.setCurrent("ChooseLevel");
}
else if (this.getString(this.getSelectedIndex()) == "继续") {
parent.setCurrent("Continue");
}
}
}
public void addContinue() {
if (this.getString(0) != "继续") {
this.insert(0, "继续", null);
this.setSelectedIndex(0, true);
}
}
public void deleteContinue() {
if (this.getString(0) == "继续") {
this.delete(0);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -