⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 midlet.java

📁 J2me唆哈的代码
💻 JAVA
字号:
/*
 * Created on 2005-9-20 by pcy
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package javax.microedition.midlet;
import javax.microedition.io.*;

import a.a.a.b.*;

import java.util.*;

public abstract class MIDlet {

    public boolean __started;
    private static Hashtable __properties=new Hashtable();;
    private MIDletManager manager;
    
    protected MIDlet() {
        super();
        __started=false;
        manager=EmulatorFrame.instance;
    }

    /**
     * ��MIDlet
     * @throws MIDletStateChangeException �������MIDlet����׳�����쳣
     * @since MIDP1.0
     */
    protected abstract void startApp() throws MIDletStateChangeException;
    /**
     * ��Ҫ��ͣMIDlet��ʱ�����
     * @since MIDP1.0
     */
    protected abstract void pauseApp();
    /**
     * �˳�MIDlet
     * @param unconditional �˳����
     * @throws MIDletStateChangeException ���MIDlet�������˳�,����׳�����쳣
     * ���unconditional���ó�true,���������쳣
     * @since MIDP1.0
     */
    protected abstract void destroyApp(boolean unconditional)throws MIDletStateChangeException;

    /**
     * ��ʾMIDlet�������״̬
     * @since MIDP1.0
     */
    public final void notifyDestroyed() {
    	__started=false;
        manager.endMIDlet();
    }
    /**
     * ��ʾMIDlet��������ͣ״̬
     *@since MIDP1.0
     */
    public final void notifyPaused(){
       
    }
    /**
     * �õ�Ӧ�ó��������
     * @param key ���Ե����
     * @return ���Ե�ֵ
     * @since MIDP1.0
     */
    public final String getAppProperty(String key){
    	String ret=(String)__properties.get(key);
    	if(ret==null){
    		ret=System.getenv(key);
    	}
    	return ret;
    }
    
    
    public final void resumeRequest(){
        
    }
    
    public final boolean platformRequest(String URL)
    	throws ConnectionNotFoundException{
        return true;
    }
    
    public final int checkPermission(String permission){
        return -1;
    }
    
    
    public void start(){
        try{
        	synchronized(this){
	        	__started=true;
	            startApp();
        	}
        }catch(Exception e){
            e.printStackTrace();
        }
    }
    
    public void stop(){
    	try{
        	if(__started){
        		destroyApp(true);
        		__started=false;
        	}
        }catch(Exception e){
            e.printStackTrace();
        }
    }
    
    public static void addProperties(String key, String value){
    	__properties.put(key,value);
    }
    public void setManager(MIDletManager manager){
    	this.manager=manager;
    }
    public MIDletManager getManager(){
    	return manager;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -