📄 shipwarmidlet.java
字号:
/*
* Created on 2005-9-6
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package shipwar;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.microedition.lcdui.*;
import java.util.Random;
/**
* @author wanggang
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class shipwarMIDlet extends MIDlet {
/**
*
*/
private Image icon;
private Image[] iconArray;
private String[] stringArray={"开始","设置游戏难度","查看游戏记录","游戏说明"};
public static shipwarMIDlet shipwarmidlet;
public shipwarMIDlet() {
super();
try{
icon=Image.createImage("/res/Icon.png");
iconArray=new Image[]{icon,icon,icon,icon};
}catch(Exception e){
System.out.println("打开图片错误");
}
MainMenu menu=new MainMenu(stringArray,iconArray,icon);
Display.getDisplay(this).setCurrent(menu);
this.shipwarmidlet=this;
// TODO Auto-generated constructor stub
}
/* (non-Javadoc)
* @see javax.microedition.midlet.MIDlet#startApp()
*/
protected void startApp() throws MIDletStateChangeException {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see javax.microedition.midlet.MIDlet#pauseApp()
*/
protected void pauseApp() {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see javax.microedition.midlet.MIDlet#destroyApp(boolean)
*/
protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
// TODO Auto-generated method stub
icon=null;
iconArray=null;
}
public static void quitApp(){
try{
shipwarmidlet.destroyApp(true);
shipwarmidlet.notifyDestroyed();
}catch(Exception e){
System.out.println("关闭错误");
}
}
public static int createRandom(int number){
Random rand=new Random();
int returnvalue=Math.abs(rand.nextInt()%number);
rand=null;
return returnvalue;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -