Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1503794
  • 博文数量: 3500
  • 博客积分: 6000
  • 博客等级: 准将
  • 技术积分: 43870
  • 用 户 组: 普通用户
  • 注册时间: 2008-05-03 20:31
文章分类

全部博文(3500)

文章存档

2008年(3500)

我的朋友

分类:

2008-05-04 20:34:23

一起学习
见程序 : //文件名 LWTDemoMIDlet.java import com.motorola.lwt.*; import javax.microedition.lcdui.*; import javax.microedition.midlet.*; public class LWTDemoMIDlet extends MIDlet implements CommandListener { class ButtonScreen extends ComponentScreen { public ButtonScreen() { // Add a button to the screen Button b1 = new Button("b"); ///////////下面的代码是设定按钮高度 b1.setBottomEdge(Component.HEIGHT, 30); ///////////下面的代码是设定按钮宽度 b1.setRightEdge(Component.WIDTH,80); ///////////下面的代码是设定按钮y坐标,a相对屏幕最上 b1.setTopEdge(Component.SCREEN_TOP, 10); ///////////下面的代码是设定按钮x坐标相对前一个控件 b1.setLeftEdge(Component.PREVIOUS_COMPONENT_RIGHT, 30); add(b1); // Add another button to the screen Button b2 = new Button("点我就行了"){ public void componentActuated() { Show(); } }; // Extend the right edge to the right edge of the screen b2.setRightEdge(Component.WIDTH, 220); b2.setBottomEdge(Component.HEIGHT, b2.getPreferredHeight() * 2); add(b2); Command next = new Command("Next", Command.OK, 1); Command prev = new Command("Previous", Command.BACK, 1); addCommand(next); addCommand(prev); } }; ButtonScreen screens = new ButtonScreen(); public LWTDemoMIDlet() { screens.setCommandListener(this); } protected void startApp() throws MIDletStateChangeException { Display.getDisplay(this).setCurrent(screens); } protected void pauseApp() { } protected void destroyApp(boolean unconditional) throws MIDletStateChangeException { } public void Show() { System.out.println("Get it on main Class"); } public void commandAction (Command c, Displayable d) { if (screens == d) { // Found it, check which command was triggered if (c.getCommandType() == Command.BACK) { System.out.println("back"); } else if (c.getCommandType() == Command.OK) { System.out.println("ok"); } return; } } } 以上程序用jcreater pro motoSDK 编译 下载本文示例代码


motorola手机中在主类中响应motorola手机中在主类中响应motorola手机中在主类中响应motorola手机中在主类中响应motorola手机中在主类中响应motorola手机中在主类中响应motorola手机中在主类中响应motorola手机中在主类中响应motorola手机中在主类中响应motorola手机中在主类中响应motorola手机中在主类中响应motorola手机中在主类中响应
阅读(64) | 评论(0) | 转发(0) |
0

上一篇:(11)总结

下一篇:Mobile Media API概述

给主人留下些什么吧!~~