📄 mainmenu.java
字号:
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.List;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.Displayable;
public class MainMenu extends List implements CommandListener
{
private BeatBrick theMidlet;
private Command go;
private Command back;
protected MainMenu(BeatBrick midlet)
{
super("",IMPLICIT);
theMidlet=midlet;
append("New Game",null);
append("Help",null);
append("About",null);
append("Exit",null);
setCommandListener(this);
}
public void commandAction(Command command,Displayable displayable)
{
String selected=getString(getSelectedIndex());
if(selected.equals("New Game"))
theMidlet.activateGameScreen();
if(selected.equals("Help")){
BeatBrick.activateDisplayable(
new TextForm(this,
"1.This game has five levels!\n"+
"2.There are three balls in each round.\n"+
"3.Controls\n"+
" 4&6: move bat\n"+
" 2: tee off\n"+
" or use the arrow keys.\n"+
"4.Pills\n"+
" Red: longer bat\n"+
" Black: shorter bat\n"+
" Pink: gain a ball\n"+
" Purple: gain points\n"));
}
if(selected.equals("About")){
BeatBrick.activateDisplayable(
new TextForm(this,
"This game was designed and made by Wayne Xu!"+
" BeatBricks copyright 2006,Wayne Xu. All rights reserved."));
}
if(selected.equals("Exit"))
theMidlet.close();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -