mainmenu.java

来自「青蛙過河~ 就是青蛙過馬路 過馬路很危險請小心... that s a」· Java 代码 · 共 42 行

JAVA
42
字号
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.Displayable; 


public class MainMenu extends Form implements CommandListener{
	
	
   	private RoadRun theMidlet;
   	private Command start;
   	private Command exit;

   	protected MainMenu(RoadRun midlet){

      	super("");

      	theMidlet = midlet;
      	
		// add the welcome text
	    append("\nWelcome to\n");
	    append("R-O-A-D R-U-N");
	    
		// create and add the commands
	    int priority = 1; 
	    start = new Command("Start", Command.SCREEN, priority++);
	    exit = new Command("Exit", Command.EXIT, priority++);
	
	    addCommand(start);
	    addCommand(exit);
	
	    setCommandListener(this);
	}

   	public void commandAction(Command command, Displayable displayable){
      	if (command == start)
         	theMidlet.activateGameScreen();   //笴栏币笆
      	if (command == exit)
         	theMidlet.close();
   	}
}

⌨️ 快捷键说明

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