mainmenu.java
来自「由J2ME开发的能在NOKIA S40上运行的手机游戏!开发者:徐巍!qq:18」· Java 代码 · 共 52 行
JAVA
52 行
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 + =
减小字号Ctrl + -
显示快捷键?