ExListMenu.java
上传用户:gyyuli
上传日期:2013-07-09
资源大小:3050k
文件大小:1k
源码类别:

J2ME

开发平台:

Java

  1. package exframework;
  2. /**
  3.  * <p>Title: ExFramework</p>
  4.  *
  5.  * <p>Description: lizhenpeng</p>
  6.  *
  7.  * <p>Copyright: Copyright (c) 2005</p>
  8.  *
  9.  * <p>Company: LP&P</p>
  10.  *
  11.  * @author lipeng
  12.  * @version 1.0
  13.  */
  14. import javax.microedition.lcdui.*;
  15. public class ExListMenu
  16.   implements AllAction,CommandListener
  17. {
  18.   boolean isVolOn;
  19.   MainForm form;
  20.   public void commandAction(Command c,Displayable d)
  21.   {
  22.     int index=((List)d).getSelectedIndex();
  23.     switch(index)
  24.     {
  25.       case 0:
  26.         form.deleteAll();
  27.         form.addline("开始游戏");
  28.         Display.getDisplay(form.midlet).setCurrent(form);
  29.         break;
  30.       case 1:
  31.         form.deleteAll();
  32.         form.addline("栽入进度");
  33.         Display.getDisplay(form.midlet).setCurrent(form);
  34.         break;
  35.       case 2:
  36.         isVolOn = !isVolOn;
  37.         if(isVolOn)
  38.         {
  39.           ((List)d).set(index,"声音开",null);
  40.         }
  41.         else
  42.         {
  43.           ((List)d).set(index,"声音关",null);
  44.         }
  45.         break;
  46.     }
  47.   }
  48.   public void allAction(MainForm form)
  49.   {
  50.     this.form = form;
  51.     String[] listItem=
  52.       {
  53.       "开始游戏",
  54.       "栽入进度",
  55.       "声音开",
  56.     };
  57.     isVolOn = true;
  58.     List listMenu=new List(null,Choice.IMPLICIT,listItem,null);
  59.     listMenu.addCommand(List.SELECT_COMMAND);
  60.     listMenu.setCommandListener(this);
  61.     Display.getDisplay(form.midlet).setCurrent(listMenu);
  62.   }
  63. }