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

J2ME

开发平台:

Java

  1. import javax.microedition.midlet.MIDlet;
  2. import javax.microedition.lcdui.*;
  3. public class CommandDemo_2 extends MIDlet {
  4.     private Display display;
  5.     private TextBox textBox;
  6.     public CommandDemo_2() {
  7.     display = Display.getDisplay(this);
  8.     textBox = new TextBox("Command演示","添加了多个Command命令",50,0);
  9.     textBox.addCommand(new Command("Open",Command.SCREEN,1));
  10.     textBox.addCommand(new Command("Save",Command.SCREEN,1));
  11.     textBox.addCommand(new Command("Info",Command.SCREEN,1));
  12.     textBox.addCommand(new Command("Back",Command.SCREEN,1));
  13.     textBox.addCommand(new Command("Exit",Command.SCREEN,1));
  14.     }
  15.     protected void startApp() {
  16.     display.setCurrent(textBox);
  17.     }
  18.     protected void destroyApp(boolean unconditional) {
  19.     }
  20.     protected void pauseApp() {
  21.     }
  22. }