SpacerDemo.java
资源名称:J2ME&Game.rar [点击查看]
上传用户:gyyuli
上传日期:2013-07-09
资源大小:3050k
文件大小:1k
源码类别:
J2ME
开发平台:
Java
- import javax.microedition.lcdui.*;
- import javax.microedition.midlet.MIDlet;
- public class SpacerDemo
- extends MIDlet
- implements CommandListener{
- private Display display;
- private Form mainForm;
- private StringItem item;
- private Spacer spacer;
- private final static Command CMD_GO = new Command("Go",Command.ITEM,1);
- private final static Command CMD_PRESS =
- new Command("Press", Command.ITEM, 1);
- private final static Command CMD_EXIT =
- new Command("Exit", Command.EXIT, 1);
- protected void startApp() {
- display = Display.getDisplay(this);
- mainForm = new Form("Spacer演示");
- mainForm.append(new StringItem("", "BUTTON_1", Item.BUTTON));
- mainForm.append(new Spacer(80,15));
- mainForm.append(new StringItem("", "BUTTON_2", Item.BUTTON));
- mainForm.append(new Spacer(80,15));
- mainForm.append(new StringItem("", "BUTTON_3", Item.BUTTON));
- mainForm.append(new Spacer(80,15));
- mainForm.append(new StringItem("", "BUTTON_4", Item.BUTTON));
- mainForm.addCommand(CMD_EXIT);
- mainForm.setCommandListener(this);
- display.setCurrent(mainForm);
- }
- public void commandAction(Command c, Displayable d) {
- destroyApp(false);
- notifyDestroyed();
- }
- protected void destroyApp(boolean unconditional) {
- }
- protected void pauseApp() {
- }
- }