CustomItemDemo.java
资源名称:J2ME&Game.rar [点击查看]
上传用户:gyyuli
上传日期:2013-07-09
资源大小:3050k
文件大小:1k
源码类别:
J2ME
开发平台:
Java
- import javax.microedition.lcdui.*;
- import javax.microedition.midlet.*;
- public class CustomItemDemo
- extends MIDlet
- implements CommandListener {
- private Display mDisplay;
- private Form mMainForm;
- public CustomItemDemo() {
- mMainForm = new Form("用CustomItem实现自定义图像");
- DiamondItem di = new DiamondItem("DiamondItem");
- mMainForm.append(di);
- mMainForm.addCommand(new Command("Exit", Command.EXIT, 0));
- mMainForm.setCommandListener(this);
- mDisplay = Display.getDisplay(this);
- }
- public void startApp() {
- mDisplay.setCurrent(mMainForm);
- }
- public void pauseApp() {
- }
- public void destroyApp(boolean unconditional) {}
- // CommandListener method
- public void commandAction(Command c, Displayable s) {
- if (c.getCommandType() == Command.EXIT)
- notifyDestroyed();
- }
- }