sliderform.java

来自「Java ME手机应用开发大全一书的配套光盘上的源码」· Java 代码 · 共 53 行

JAVA
53
字号

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class SliderForm 
               extends MIDlet implements CommandListener
{
  private Display display;
  private Form form; 
  private Command exit; 
  public SliderForm()
  {
    display = Display.getDisplay(this);
    exit = new Command("退出", Command.SCREEN, 1);
    StringItem message[] = new StringItem[15];
    message[0] = new StringItem("短消息1 ", "未读短消息");
    message[1] = new StringItem("短消息2 ", "未读短消息");
	message[2] = new StringItem("短消息3 ", "未读短消息");
    message[3] = new StringItem("短消息4 ", "未读短消息");
	message[4] = new StringItem("短消息5 ", "已读短消息");
    message[5] = new StringItem("短消息6 ", "已读短消息");
	message[6] = new StringItem("短消息7 ", "已读短消息");
    message[7] = new StringItem("短消息8 ", "已读短消息");
	message[8] = new StringItem("短消息9 ", "已读短消息");
    message[9] = new StringItem("短消息10 ", "已读短消息");
	message[10] = new StringItem("短消息11 ", "已读短消息");
	message[11] = new StringItem("短消息12 ", "已读短消息");
    message[12] = new StringItem("短消息13 ", "已读短消息");
	message[13] = new StringItem("短消息14 ", "已读短消息");
    message[14] = new StringItem("短消息15 ", "已读短消息");
    form = new Form("收件箱", message);
    form.addCommand(exit);
    form.setCommandListener(this);
  }
  public void startApp()
  {
   display.setCurrent(form);
  }
  public void pauseApp()
  {
  }
  public void destroyApp(boolean unconditional) 
  {
  }      
  public void commandAction(Command command, Displayable displayable)
  {
    if (command == exit)
    {
      destroyApp(true);
      notifyDestroyed();
    }
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?