?? 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 + -