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

📄 listtest3.java

📁 《精彩的手机UI例程.zip》是很好的手机编辑软件
💻 JAVA
字号:

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class ListTest3 extends MIDlet implements CommandListener{
	private List list;
	private Command exitCommand = new Command("Exit", Command.BACK, 1);
	private String[] options={"Option A","Option B","Option C"};	
	private Display display;
	
    public ListTest3() {
        //create an implicit list
	list= new List("Implicit-choice list",List.IMPLICIT,
                        options, null);
        //Add commands 
	list.addCommand(exitCommand);
	list.setCommandListener(this);

	display=Display.getDisplay(this);
    }
    public void startApp() throws MIDletStateChangeException {
        display.setCurrent(list);
    }

    /**
     * Pause the MIDlet
     */
    public void pauseApp() {
    }

    /**
     * Called by the framework before the application is unloaded
     */
    public void destroyApp(boolean unconditional) {
        //clear everything
	list=null;
	exitCommand = null;
	display=null;
    }

    public void commandAction(Command c, Displayable d) {
        if(d==list && c==List.SELECT_COMMAND) {
            System.out.println(options[list.getSelectedIndex()]+" is selected");
        }
        else if(c==exitCommand) {
            destroyApp(true);
	    notifyDestroyed();
	}
    }
}

⌨️ 快捷键说明

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