📄 mwario.java
字号:
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.*;
import javax.microedition.midlet.MIDlet;
public class mWario extends MIDlet implements CommandListener{
private mWarioCanvas gameCanvas;
private final static Command start=new Command("开始",Command.OK,1);
private final static Command exit=new Command("退出",Command.EXIT,1);
private Display display;
public void startApp(){
Image zerosun=null;
try{
zerosun=Image.createImage("/zerosun.png"[img]/images/wink.gif[/img];
}
catch(java.io.IOException e){
System.out.println("Can not open image file:zerosun"[img]/images/wink.gif[/img];
}
Image blackzero=null;
try{
blackzero=Image.createImage("/blackzero.png"[img]/images/wink.gif[/img];
}
catch(java.io.IOException e){
System.out.println("Can not open image file:blackzero"[img]/images/wink.gif[/img];
}
Image menuPic=null;
try{
menuPic=Image.createImage("/menuPic.png"[img]/images/wink.gif[/img];
}
catch(java.io.IOException e){
System.out.println("Can not open image file:menuPic"[img]/images/wink.gif[/img];
}
Alert gameMenu=new Alert("瓦利奥制造",null,zerosun,AlertType.INFO);
gameMenu.setTimeout(6000);
display=Display.getDisplay(this);
display.setCurrent(gameMenu);
synchronized(this){
try{
wait(2000);
}
catch(Exception e){
System.out.println("wait error"[img]/images/wink.gif[/img];
}
}
gameMenu.setImage(null);
synchronized(this){
try{
wait(300);
}
catch(Exception e){
System.out.println("wait error"[img]/images/wink.gif[/img];
}
}
gameMenu.setImage(blackzero);
synchronized(this){
try{
wait(2000);
}
catch(Exception e){
System.out.println("wait error"[img]/images/wink.gif[/img];
}
}
gameMenu.setImage(null);
synchronized(this){
try{
wait(300);
}
catch(Exception e){
System.out.println("wait error"[img]/images/wink.gif[/img];
}
}
gameMenu.setImage(menuPic);
gameMenu.setTimeout(Alert.FOREVER);
display=Display.getDisplay(this);
display.setCurrent(gameMenu);
gameMenu.addCommand(start);
gameMenu.addCommand(exit);
gameMenu.setCommandListener(this);
if(gameCanvas==null)
gameCanvas=new mWarioCanvas();
}
public void pauseApp(){
}
public void destroyApp(boolean unconditional){
}
public void commandAction(Command c,Displayable s){
if(c==start){
gameCanvas.startGame();
Display.getDisplay(this).setCurrent(gameCanvas);
}
else if(c==exit){
try{
destroyApp(false);
notifyDestroyed();
}
catch(Exception e){
System.out.println("Close MIDlet error"[img]/images/wink.gif[/img];
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -