?? libmidlet.java
字號(hào):
/*
* LibMidlet.java
*
* Created on 2006年5月11日, 下午12:05
*/
package cn.edu.uestc.pandawireless;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import cn.edu.uestc.pandawireless.ui.*;
import cn.edu.uestc.pandawireless.model.*;
import java.util.Date;
/**
*
* @author 熊貓曉希
* @version
*/
public class LibMidlet extends MIDlet implements CommandListener{
private Display display = null;
private UIControler uicontroler;
public AlarmModel model = null;
public static final Command stopCommand = new Command("停止",Command.EXIT, 1);
public LibMidlet(){
display = Display.getDisplay(this);
uicontroler = new UIControler(this);
model = new AlarmModel();
}
public void startApp() {
//AlarmModel model = new AlarmModel();
String[] strs = model.readStrings();
int i = 0;
Date tnow = new Date();
String ss = AlarmModel.getString(tnow);
if(strs == null){
//非PUSH注冊(cè)喚醒MIDlet情況下,顯示主界面
uicontroler.initUpdate();
//return;
}else{
while(i<strs.length)
{
int index = strs[i].indexOf('n');
String snow = strs[i].substring(0, index);
String bookname = strs[i].substring(index+1);
//System.out.println("snow:"+snow);
if(snow != null){//RMS中存在以前注冊(cè)的時(shí)間
//System.out.println("tnow:"+s);
//判斷當(dāng)前時(shí)間是否與注冊(cè)時(shí)間相同
if(snow.equals(ss)){
//相等,代表時(shí)PUSH注冊(cè)喚醒了MIDlet
Form f = new Form("提醒");
//f.setString(" 老大,該還書了,要不然又要被罰錢了!\n提醒你:你的這本<<"+bookname+">>該還了!!");
f.append(" 老大,該還書了,要不然又要被罰錢了!\n提醒你:你的這本<<"+bookname+">>該還了!!");
f.addCommand(stopCommand);
f.setCommandListener(this);
//播放聲音
model.playSound();
display.setCurrent(f);
//return;
break;
}
}
i++;
}
if(i >= strs.length){
//非PUSH注冊(cè)喚醒MIDlet情況下,顯示主界面
uicontroler.initUpdate();
}
}
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public void exit(){
this.destroyApp(false);
this.notifyDestroyed();
}
public void commandAction(Command cmd,Displayable displayable){
if(cmd == stopCommand){
model.stopSound();
uicontroler.initUpdate();
}
}
public void setCurrent(Displayable displayable){
display.setCurrent(displayable);
}
public void setCurrent(Alert alert,Displayable displayable){
display.setCurrent(alert,displayable);
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -