石頭JAVA擺地?cái)們?/a>

          JAVA所有的討論-要一點(diǎn)一點(diǎn)的進(jìn)步

            BlogJava :: 首頁 ::  :: 聯(lián)系 ::  :: 管理 ::
            30 隨筆 :: 0 文章 :: 11 評(píng)論 :: 0 Trackbacks

           留個(gè)紀(jì)念:

          package j2me;

          import
           java.io.IOException;

          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.MIDlet;
          import
           javax.microedition.midlet.MIDletStateChangeException;

          public class j2me1 extends MIDlet implements
           CommandListener {

              Display display 
          = null
          ;

              
          public
           j2me1() {
                  
          // TODO Auto-generated constructor stub

              }

              
          protected void destroyApp(boolean arg0) throws
           MIDletStateChangeException {
                  
          // TODO Auto-generated method stub


              }

              
          protected void pauseApp() {
                  
          // TODO Auto-generated method stub


              }

              
          protected void startApp() throws MIDletStateChangeException {
                  display 
          = Display.getDisplay(this
          );
                  Image img 
          = null
          ;
                  
          //
           Form form = new Form("標(biāo)題");
                  
          //
           form.setTicker(new Ticker("我的ticker"));
                  
          //
           form.addCommand(new Command("提交", "提交長(zhǎng)", Command.OK, 1));
                  
          //
           form.addCommand(new Command("取消", "取消長(zhǎng)", Command.BACK, 1));
                  
          // form.setCommandListener(new j2me1_commandlistener_impl());

                  try {
                      img 
          = Image.createImage("/res/new.PNG"
          );
                  } 
          catch
           (IOException e) {
                      
          // TODO Auto-generated catch block

                      e.printStackTrace();
                  }

                  List list 
          = new List("ghyghost's list"
          , Choice.MULTIPLE);
                  list.append(
          "1"
          , img);
                  list.append(
          "2"
          , img);
                  list.append(
          "3"
          , img);
                  list.append(
          "4"
          , img);

                  list.setSelectedIndex(
          2true
          );

                  list.addCommand(
          new Command("提交""提交長(zhǎng)", Command.OK, 1
          ));
                  list.setCommandListener(
          this
          );

                  display.setCurrent(list);
              }

              
          public void
           commandAction(Command command, Displayable displayable) {
                  
          if (command ==
           List.SELECT_COMMAND) {
                      System.out.println(
          "c == List.SELECT_COMMAND"
          );
                      System.out.println(command.getLabel());
                      System.out.println(
          "index ="

                              
          + ((List) displayable).getSelectedIndex());
                      System.out.println(
          "String ="

                              
          + ((List) displayable).getString(((List) displayable)
                                      .getSelectedIndex()));
                  } 
          else
           {
                      System.out.println(
          "button click"
          );
                      System.out.println(
          "button name is:" +
           command.getLabel());
                      System.out.println(command.getLabel());
                      System.out.println(
          "index ="

                              
          + ((List) displayable).getSelectedIndex());
                      System.out.println(
          "String ="

                              
          + ((List) displayable).getString(((List) displayable)
                                      .getSelectedIndex()));
                  }
              }
          }

          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 射阳县| 望谟县| 从江县| 罗定市| 云梦县| 通辽市| 肇州县| 大安市| 浏阳市| 广宁县| 兴海县| 平潭县| 类乌齐县| 大田县| 横峰县| 新建县| 岢岚县| 科尔| 平武县| 汕尾市| 本溪市| 丁青县| 宜昌市| 巴林左旗| 鄂尔多斯市| 广德县| 林口县| 屏山县| 安国市| 德钦县| 金门县| 绥宁县| 正镶白旗| 卢氏县| 乐亭县| 吉安县| 龙门县| 六枝特区| 康保县| 洛宁县| 睢宁县|