zoukankan      html  css  js  c++  java
  • Command对象

    import javax.microedition.lcdui.Command;
    import javax.microedition.lcdui.CommandListener;
    import javax.microedition.lcdui.Display;
    import javax.microedition.lcdui.Displayable;
    import javax.microedition.lcdui.Form;
    import javax.microedition.lcdui.Ticker;
    import javax.microedition.midlet.MIDlet;
    import javax.microedition.midlet.MIDletStateChangeException;
    
    
    public class commandObject extends MIDlet implements CommandListener{
    
     private Display display;
     Form f;
     public commandObject() {
      super();
     }
    
     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);
      f=new Form("Command test");
      Command start=new Command("开始",Command.OK,1);
      Command stop=new Command("退出",Command.EXIT,1);
      f.addCommand(start);
      f.addCommand(stop);
      f.setCommandListener(this);
      display.setCurrent(f);
     }
     
     public void commandAction(Command c,Displayable d)
     {
      String cmd = c.getLabel();
      if(cmd.equals("开始"))
      {
       f.setTicker(new Ticker("running ..."));
       
      }
      else if(cmd.equals("退出"))
      {
       f.setTicker(null);
      }
     }
    }
  • 相关阅读:
    静态成员变量
    设计模式:空对象模式(Null Object Pattern)
    超详细LAMP环境搭建
    WCF 学习笔记之双工实现
    new和instanceof的内部机制
    C#开源磁盘/内存缓存引擎
    C++设计模式-Flyweight享元模式
    Javascript内存泄漏
    流量计数器
    运用Mono.Cecil 反射读取.NET程序集元数据
  • 原文地址:https://www.cnblogs.com/wangchunming/p/2451386.html
Copyright © 2011-2022 走看看