📄 imageitemsplash.java~4~
字号:
package imageitemsplash;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class ImageItemSplash extends MIDlet implements CommandListener,Runnable {
static ImageItemSplash instance;
private Image imgSplash;
private ImageItem ImgItmSplash;
private Form formSplash;
private List menuList;
Image[] listIconImage;
Thread appThread;
private String[] menuItem={"单选","多选","退出"};
public ImageItemSplash() {
instance = this;
//imgSplash = loadImage("/res/read.png");
try{imgSplash = Image.createImage("/res/read.png");}
catch(java.io.IOException ie){}
listIconImage = new Image[menuItem.length];
try{ for(int i=0;i<menuItem.length;i++){
listIconImage[i]=Image.createImage("/pic/icon"+i+".png");
}}catch(java.io.IOException iow){}
menuList = new List("选择测试题型",List.IMPLICIT,menuItem,listIconImage);
ImgItmSplash = new ImageItem("",imgSplash,ImageItem.LAYOUT_CENTER|
ImageItem.LAYOUT_NEWLINE_AFTER,null);
formSplash = new Form("测试程序1.0版");
formSplash.append(ImgItmSplash);
formSplash.append("程序正在启动……");
menuList.setCommandListener(this);
appThread = new Thread(this);
}
public void startApp() {
Display.getDisplay(this).setCurrent(formSplash);
appThread.start();
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void commandAction(Command c,Displayable d){
if(c==List.SELECT_COMMAND){
int index = menuList.getSelectedIndex();
if(index==2){
quitApp();
}else{
Alert msgAlert = new Alert("提示","功能实现参加list类的演示程序",
null,AlertType.INFO);
msgAlert.setTimeout(2000);
Display.getDisplay(this).setCurrent(msgAlert);
}
}
}
public void run(){
long timeStart = System.currentTimeMillis();
while(appThread!=null){
try{
appThread.sleep(3000);
}catch(Exception e) {}
long timeEnd = System.currentTimeMillis();
if((timeEnd-timeStart)==3000){
Display.getDisplay(this).setCurrent(menuList);
appThread = null;
}
}
}
public static void quitApp() {
instance.destroyApp(true);
instance.notifyDestroyed();
instance = null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -