我们在MIDlet应用程序里使用javax.microedition.lcdui包下的Display、Choice、List类,功能分别是显示列表、选择列表、定义列表框。
import javax.microedition.lcdui.Choice;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.List;
import javax.microedition.midlet.MIDlet;
public class AjavaMIDlet extends MIDlet {
private String[] capabilitiesIdx = { "首页", "技术论坛",
"我的博客", "朋友圈", "资源中心", "原创教程",
"新鲜博文", "源码实例", "在线文档", "行业资讯" };
public void startApp() {
List list = new List("ajava.org社区", Choice.IMPLICIT);
for (int i = 0; i < capabilitiesIdx.length; ++i) {
list.append("ajava.org菜单 - " + capabilitiesIdx[i], null);//生成显示列表
}
Display.getDisplay(this).setCurrent(list);//显示到屏幕
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
}