📄 homereceivemidelt.java
字号:
package cn.com.javachen;
import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Image;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
public class HomeReceiveMidelt extends MIDlet {
protected Display display;
private Image splashLogo;
private boolean isSplash = true;
private MainMenuScreen mainMenuScreen;
private SettingsScreen settingsScreen;
private XueShengCJScreen xueShengCJScreen;
private XueShengQQScreen xueShengQQScreen;
private JiaZhangFQScreen jiaZhangFQScreen;
private HelpScreen helpScreen;
private AboutScreen aboutScreen;
private Alert alert;
private static Settings settings;
private static final String settingsRMSName = "xushengSettings";
private static final boolean CONST_DEBUG = true;
public HomeReceiveMidelt() {
// TODO Auto-generated constructor stub
display = Display.getDisplay(this);
}
protected void startApp() throws MIDletStateChangeException {
// TODO Auto-generated method stub
if (isSplash) {
isSplash = false;
try {
alert = new Alert("欢迎第一次使用!请选择“设置信息”选项.");
settings = new Settings(settingsRMSName);
settings.loadSettings();
mainMenuScreen = new MainMenuScreen(this);
settingsScreen = new SettingsScreen(this, settings);
xueShengCJScreen = new XueShengCJScreen(this,settings);
xueShengQQScreen = new XueShengQQScreen(this,settings);
jiaZhangFQScreen = new JiaZhangFQScreen(this,settings);
helpScreen = new HelpScreen(this);
aboutScreen = new AboutScreen(this);
splashLogo = Image.createImage("/res/splash.png");
new SplashScreen(display, mainMenuScreen, splashLogo, 3000);
} catch (Exception ex) {
showErrorMsg(null);
}
} else {
mainMenuScreenShow(null);
}
}
public void mainMenuScreenShow(Alert alert) {
// TODO Auto-generated method stub
if (alert == null)
display.setCurrent(mainMenuScreen);
else
display.setCurrent(alert, mainMenuScreen);
}
protected void pauseApp() {
// TODO Auto-generated method stub
}
protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
// TODO Auto-generated method stub
System.gc();
notifyDestroyed();
}
public void mainMenuScreenQuit() {
// TODO Auto-generated method stub
try {
destroyApp(true);
} catch (MIDletStateChangeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
protected void showErrorMsg(String alertMsg) {
if (alertMsg == null || CONST_DEBUG == false) {
alertMsg = "Error Starting HomeReceive, may or may not function correctly. Please contact support.";
}
alert = new Alert("Eliminator ERROR", alertMsg, null, null);
alert.setTimeout(Alert.FOREVER);
alert.setType(AlertType.ERROR);
this.mainMenuScreenShow(alert);
}
protected static Image createImage(String filename) {
Image image = null;
try {
image = Image.createImage(filename);
} catch (Exception e) {
}
return image;
}
protected void XueShengCJScreenShow() {
display.setCurrent(xueShengCJScreen);
}
protected void xueShengQQScreenShow() {
display.setCurrent(xueShengQQScreen);
}
protected void jiaZhangFQScreenShow() {
display.setCurrent(jiaZhangFQScreen);
}
protected void settingsScreenShow() {
try {
settingsScreen.init();
display.setCurrent(settingsScreen);
} catch (Exception e) {
// showErrorMsg(null);
}
}
protected void helpScreenShow() {
display.setCurrent(helpScreen);
}
protected void aboutScreenShow() {
display.setCurrent(aboutScreen);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -