文档详情

J2ME手机游戏设计案例源代码—TestList.doc

发布:2017-04-04约3.89千字共4页下载文档
文本预览下载声明
*********TestListMID /* * To change this template, choose Tools | Templates * and open the template in the editor. */ import javax.microedition.lcdui.Choice; import javax.microedition.lcdui.Command; import javax.microedition.lcdui.CommandListener; import javax.microedition.lcdui.Display; import javax.microedition.lcdui.Displayable; import javax.microedition.lcdui.Image; import javax.microedition.lcdui.List; import javax.microedition.midlet.*; /** * @author Administrator */ public class TestListMID extends MIDlet implements CommandListener { //这里注意如何使用 //CommandListener 这个接口 private final static Command CMD_EXIT = new Command(Exit, Command.EXIT, 1); private final static Command CMD_BACK = new Command(Back, Command.BACK, 1); private Display display; private List mainList; private List exclusiveList; private List implicitList; private List multipleList; private boolean firstTime; Image[] imageArray= null; public TestListMID() { display = Display.getDisplay(this); String[] stringArray = {选项 A,选项 B,选项 C,选项 D}; //待传入进行初始化的 String 数组,即 Choice 选项的文字部分。 //这里只是为 Image[]数组进行初始化。 exclusiveList = new List(Exclusive, Choice.EXCLUSIVE, stringArray,imageArray); exclusiveList.addCommand(CMD_BACK); exclusiveList.addCommand(CMD_EXIT); exclusiveList.setCommandListener(this); //ExlcusiveList 的声明 implicitList = new List(Implicit, Choice.IMPLICIT, stringArray, imageArray); implicitList.addCommand(CMD_BACK); implicitList.addCommand(CMD_EXIT); implicitList.setCommandListener(this); //ImplicitList 的声明 multipleList = new List(Multiple, Choice.MULTIPLE, stringArray, imageArray); multipleList.addCommand(CMD_BACK); multipleList.addCommand(CMD_EXIT); multipleList.setCommandListener(this); //MutipleList 的声明 firstTime = true;
显示全部
相似文档