test_list.java

来自「日程安排 功能还不完善 似的 还得补充」· Java 代码 · 共 31 行

JAVA
31
字号
import javax.microedition.lcdui.*;

public class test_list implements CommandListener{
Midlet midlet=null;
String[] course={"java","javaweb","db"};
Command command=new Command("选择",Command.OK,1);
List list=new List("课程",List.MULTIPLE,course,null);
	public test_list(Midlet midlet)
	{
		Display.getDisplay(midlet).setCurrent(list);
		list.addCommand(command);
		list.setCommandListener(this);
	}
	public void commandAction(Command cmd, Displayable arg1) {
		if(cmd==command)
		{
//			int id=list.getSelectedIndex();
//			System.out.println(id);
			boolean[] flag=new boolean[3];
			list.getSelectedFlags(flag);
		for(int i=0;i<flag.length;i++)
		{
			if(flag[i]==true)
			{
				System.out.println(i+"选中了");
			}
		}
		}
	}
}

⌨️ 快捷键说明

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