userdefmid.java

来自「J2ME MIDP 2.0 无线设备编程的一些源码」· Java 代码 · 共 43 行

JAVA
43
字号
//UserDefMID.java file
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;

public class UserDefMID extends MIDlet implements CommandListener
{

    private Command exitCommand;
    private TextBox tb;
    public UserDefMID()
    {
        exitCommand =new Command("Exit",Command.EXIT,1);
        tb =new TextBox("UserDefMID MIDlet","UserDefMID",15,0);
        tb.addCommand(exitCommand);
        tb.setCommandListener(this);
    }
    protected void startApp(  ) throws MIDletStateChangeException
    {
        System.out.println("Para1 = " + getAppProperty("Para1"));
        System.out.println("Para2 = " + getAppProperty("Para2"));
        System.out.println("MIDlet-Name = " + getAppProperty("MIDlet-Name"));
        System.out.println("MIDlet-Vendor = " + getAppProperty("MIDlet-Vendor"));
        System.out.println("MIDlet-Version = " + getAppProperty("MIDlet-Version"));
        Display.getDisplay(this).setCurrent(tb);
    }

    protected void pauseApp(  )
    {
    }

    protected void destroyApp( boolean p1 )
    {
    }

    public void commandAction(Command c,Displayable d)
    {
        if (c ==exitCommand)
        {
            destroyApp(false);
            notifyDestroyed();
        }
    }
}

⌨️ 快捷键说明

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