?? splashcanvas.java~23~
字號:
package gamemidlet;
import javax.microedition.lcdui.*;
/**
* <p>Title: 黃小輝8000106286網(wǎng)通062班</p>
* <p>Description: GameMIDlet</p>
* <p>Copyright: Copyright (c) 2009</p>
* <p>Company: NCU</p>
* @author not attributable
* @version 1.0
*/
public class SplashCanvas
extends Canvas
implements Runnable {
private final int stayTime;
private Font nowfont;
private static Image AppImg = null;
private int currentTime;
private MenuCanvas menu;
private Thread thread;
private static String AppName = "手機(jī)坦克大戰(zhàn)";
private static String AppVersion = "版本2.0.0";
public SplashCanvas(int stayTime) {
currentTime = 0;
this.stayTime=stayTime;
nowfont = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_MEDIUM);
AppImg = GameMIDlet.loadImage("/pic/applogo.png");
menu = new MenuCanvas();
this.setFullScreenMode(true);
thread = new Thread(this);
}
private void showMenu() {
Display.getDisplay(GameMIDlet.instance).setCurrent(menu);
}
public void startRun() {
System.out.println("jdfjejgf");
thread.start();
}
public void run() {
for (; currentTime < stayTime; currentTime += 50) {
try {
thread.sleep(50L);
}
catch (InterruptedException interuptedexception) {}
if(currentTime==stayTime){
showMenu();
}
}
}
protected void paint(Graphics g) {
g.setColor(0x00000000);
g.fillRect(0, 0, this.getWidth(), this.getHeight());
int w = AppImg.getWidth();
int h = AppImg.getHeight();
int x = (this.getWidth() - w) / 2;
int y = (this.getHeight() - h) / 2;
int fontH = nowfont.getHeight();
int fontW = nowfont.stringWidth(AppName);
g.drawImage(AppImg, x, y - h / 2, Graphics.TOP | Graphics.LEFT);
g.setColor(255, 255, 255);
g.setFont(nowfont);
g.drawString(AppName, (this.getWidth() - fontW) / 2, y + h / 2 + 3,
Graphics.TOP | Graphics.LEFT);
fontW = nowfont.stringWidth(AppVersion);
g.drawString(AppVersion, (this.getWidth() - fontW) / 2,
y + h / 2 + fontH + 3, Graphics.TOP | Graphics.LEFT);
}
protected void keyPressed(int i) {
currentTime = stayTime;
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -