www.pudn.com > 50code.rar > DifferenceMidlet.java, change:2007-02-26,size:988b


import javax.microedition.lcdui.Display; 
import javax.microedition.midlet.MIDlet; 
import javax.microedition.midlet.MIDletStateChangeException; 
 
import demo.MainCanvas; 
 
 
public class DifferenceMidlet extends MIDlet { 
	public static DifferenceMidlet midlet; 
	private static MainCanvas m_MainCanvas;   //定义MainCanvas的引用 
	public DifferenceMidlet() {		 
		super();	//初始化,继承MIDlet类的构造	 
		midlet = this; 
	}	 
	protected void startApp() throws MIDletStateChangeException {	 
		//程序开始运行,为m_MainCanvas分配存储空间		 
		try{			 
			m_MainCanvas = new MainCanvas();  //分配存储空间 
		}		 
		catch (Exception ex){ }                   //不做错误处理 
		//设m_MainCanvas为屏幕的当前画布 
		Display.getDisplay(this).setCurrent(m_MainCanvas);	 
	}	 
	protected void pauseApp() {       
		//由被呼叫或其他原因使程序暂停		 
		m_MainCanvas.Stop(); 
	}	 
	protected void destroyApp(boolean arg0)  
					throws MIDletStateChangeException {	 
		m_MainCanvas.Stop(); 
	} 
}