?? baseview.java
字號(hào):
/*
* Created on 2005-3-3
*
* MVC模型
*/
package com.favo.ui;
import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
/**
* @author Favo
*
* 視圖類
*/
public abstract class BaseView {
public abstract Display getDisplay();
/**
* 簡(jiǎn)單的返回包裝的屏幕對(duì)象,不要做任何準(zhǔn)備屏幕的操作!
*/
public abstract Displayable getScreen();
/**
* 創(chuàng)建屏幕
*/
protected abstract void createView() throws Exception;
/**
* 更新屏幕
*/
public abstract void updateView() throws Exception;
/**
* 返回控制器
*/
public abstract BaseController getController();
/**
* 準(zhǔn)備屏幕
* 返回準(zhǔn)備好的屏幕對(duì)象
*/
public Displayable prepareScreen() throws Exception {
if(getScreen()==null){
createView();
} else {
updateView();
}
return getScreen();
}
/**
* 顯示當(dāng)前屏幕
*/
public void displayScreen(){
try{
getDisplay().setCurrent(prepareScreen());
} catch (Exception e) {
e.printStackTrace();
Alert al=new Alert("Error",e.toString()+'\n'+e.getMessage(),null,AlertType.ERROR);
al.setTimeout(Alert.FOREVER);
getDisplay().setCurrent(al);
}
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -