蓝色理想
pages.think
加入收藏
 栏目导航: 新闻 | 试用手记 | 评测报告 | 经验及技巧 | 资料大全 | 铃声与短信
 您现在位置:首页 < 移动通讯 < 资料大全 < MOTO手机开发的问题汇总
MOTO手机开发的问题汇总

日期:2004-4-26 0:01:18 作者:rocks 文档类型:原创 来自:蓝色理想数码站
6怎么在主类中响应按钮消息,这个对于切换显示很有帮助。

//文件名 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+MotoJ2SDK的配置与使用心得 下一页 中文显示,存储问题。把中文写入rms中,再读出。
Page : 1 2 3 4 
相关文章:
· 诺基亚手机的BUG及补救大法
· 详细了解MO的生活方式
· 手机随意收费 大家注意陷阱
· 三星X108常见问答集锦
· 四款移动随身QQ功能大比拼

蓝色理想数码站版权申明:除部分特别声明不要转载,或者授权我站独家播发的文章外,大家可以自由转载我站点的原创文章,但原作者和来自我站的链接必须保留(非我站原创的,按照原来自一节,自行链接)。文章版权归我站和作者共有。

转载要求:转载之图片、文件,链接请不要盗链到本站,且不准打上各自站点的水印,亦不能抹去我站点水印。

特别注意:本站所提供的摄影照片,相关评测,如需使用,请与原作者联系,版权归原作者所有

推荐文档】【发表评论】【关闭窗口
· 谈音质标准与音质评价方法
· MP3维修知识经验总结
· 数码相机简易自制立体影像
· 数码照片拍摄用光经验谈
· 手机游戏下载完全实用攻略
· SP智能手机使用IA资源管理器快捷键汇总
· 了解智能手机的操作系统们

· 手机游戏下载完全实用攻略
· SP智能手机使用IA资源管理器快捷键汇总
· 了解智能手机的操作系统们
· 免费WAP风起云涌 移动未来谁主?
· [香港] 结束等待!索爱Z800i行货正式开卖
· 小心你的手机也中毒!
· 手机常见九大故障自我排除法
· 16个手机相关名词释疑
· 主流无线传输技术GPRS与CDMA对比
· GPRS服务详细介绍

版权隐私 | 关于我们 | 项目合作 | 联系我们 | 受众分析 | 更多链接 | 网站地图

2004 digi.blueidea.com All rights reserved 京ICP备05002321号