📄 racingmidlet.java
字号:
package game;
import java.io.IOException;
import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Image;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
public class RacingMIDlet extends MIDlet
{
public Display display;
public GameCtrl game;
public RacingMIDlet()
{
super();
}
protected void startApp() throws MIDletStateChangeException
{
// 获得Display
display = Display.getDisplay(this);
// 获得Displayable
Displayable current = display.getCurrent();
if (current == null) {
// 装载logo图象
Image logo = null;
try
{
logo = Image.createImage("/dragon.png");
}
catch (IOException e) { }
// 显示logo
Alert splashScreen = new Alert(null, "李柏林入门作品,欢迎予以指导!", logo, AlertType.INFO);
// 延迟2秒
splashScreen.setTimeout(2000);
//新建对象
game = new GameCtrl(this);
// 显示闪屏界面
display.setCurrent(splashScreen, game);
}
else
{
// 显示当前界面
display.setCurrent(current);
}
}
protected void pauseApp() {
}
protected void destroyApp(boolean arg0) throws MIDletStateChangeException
{
}
public void quit() throws MIDletStateChangeException {
// 退出程序
destroyApp(false);
notifyDestroyed();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -