欢迎来到三一办公! | 帮助中心 三一办公31ppt.com(应用文档模板下载平台)
三一办公
全部分类
  • 办公文档>
  • PPT模板>
  • 建筑/施工/环境>
  • 毕业设计>
  • 工程图纸>
  • 教育教学>
  • 素材源码>
  • 生活休闲>
  • 临时分类>
  • ImageVerifierCode 换一换
    首页 三一办公 > 资源分类 > PPT文档下载  

    J2ME游戏开发第一章.ppt

    • 资源ID:6509111       资源大小:343.50KB        全文页数:31页
    • 资源格式: PPT        下载积分:15金币
    快捷下载 游客一键下载
    会员登录下载
    三方登录下载: 微信开放平台登录 QQ登录  
    下载资源需要15金币
    邮箱/手机:
    温馨提示:
    用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP免费专享
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    J2ME游戏开发第一章.ppt

    J2ME手机游戏开发,第一章准备知识,学习内容:了解J2ME,Java平台和J2ME技术概况第一个MIDlet程序MIDlet的生命周期搭建J2ME开发环境简单实例测试J2ME环境,J2ME(Java 2 Micro Edition)概述,手机上的应用软件经历了三个基本阶段 通话 电话薄 上网J2ME是目前手机市场上比较热门的技术,其广阔的运行平台、良好的可移植性以及较短的开发周期受到亲睐。,J2ME(Java 2 Micro Edition)概述,Sun公司将J2ME定义为“一种以广泛的消费性产品为目标的高度优化的Java运行时环境”。J2ME是为了支持像PDA、手机等小型的嵌入式或移动设备而推出的一系列的技术和规范的总称。,PDA,掌上电脑即PDA(Personal Digital Assistant),就是就是电脑的外围助理或者是个人数字助理的意思。顾名思义就是辅助个人工作的数字工具,主要提供记事、通讯录、名片交换及行程安排等功能。,Java平台和J2ME技术概况,Java的三个平台,Java平台和J2ME技术概况,Java的三个平台,JVM CVM KVM,KVM:为小型、资源受限设备所设计的紧凑的、便携的虚拟机。=128K,JVM:使用在J2SE、J2EE中,应用于系统资源相当丰富的设备上。32M,CVM:为用户和嵌入式设备设计的完全功能性JVM,JVM CVM KVM,CVM KVM是由JVM演变而来的,设备功能从小到大,CDC CLDC,CLDC:面向连接受限的设备配置,适用于低端信息家电:手机、PDA,使用KVM虚拟机,为了满足千差万别的移动设备需求,CDC:面向连接的设备配置,适用于高端信息家电:电视机顶盒、网络可视电话等,使用CVM虚拟机,不同点:面向不同设备的具体配置不同,CDC CLDC,选择性的类程序包,J2ME基本类程序包,Java虚拟机,基本配置 文件,CDC,CVM,CLDC,KVM,虚拟机、配置和简表关系图,MID配置文件,KVM&CLDC,CLDC(Connected,Limited Device Configuration面向连接受限的设备配置),J2ME的基本类程序包,所用的Java虚拟机为KVM(K虚拟机)。运行CLDC的设备具有以下特征:1)至少有192KB的内存空间2)16/32位处理器3)一个有限的电源供给(通常使用电池)4)有限的或断断续续的网络连接性(9600bit/s或更少)5)多样化的用户界面甚至没有用户界面,CLDC提供的功能,CLDC类库仅保留了JAVA规范中定义的最核心的三个包:java.io、java.lang、java.util重新定义了用于支持通用连接框架的新包:javax.microedition,解决J2ME应用的联网问题。,J2ME的体系结构,目前应用在手机上的操作系统主要有PalmOS、Symbian、Windows mobile、Linux和Android、iPhoneOS,黑莓七种。,针对手机特定的功能,比如是否支持蓝牙、三维等,由生产厂商提供可选的功能包,移动信息设备配置,MIDP移动信息设备简表,简表为相同消费电子设备的不同生产厂商提供标准化的java类库。J2ME领域里使用最广泛的是MIDP(Mobile Information Device Profile)简表。MIDP规范定义了移动信息设备类型和提供相关的API集合。,MIDlet应用程序,一个MIDP应用程序称为MIDlet,它只能使用MIDP和CLDC规范中所定义的API。MIDlet程序有点类似于常见的Applet或Servlet程序。MIDlet应用的主类需要从一个特殊的类中继承过来,并提供共用的默认的构造函数。,MIDlet Suite,移动设备上,所运行的J2ME程序的存在形式为MIDlet Suite。即一个或多个MIDlet打包在一起叫做MIDlet Suite,其表现形式是以一个.jar为后缀的文件。包含的主要信息有:1)实现MIDlet的所有类文件;2)关于.jar文件内容描述的manifest.cf文件;3)所有资源文件,如图标、图像等。,第一个MIDlet程序,import.*;import.*;public class HelloWorld extends MIDlet implements CommandListenerprivate Command exitCommand;private TextBox tb;public HelloWorld()exitCommand=new Command(退出,Command.EXIT,1);tb=new TextBox(你好!,J2ME,你好!,J2ME,15,0);tb.addCommand(exitCommand);tb.setCommandListener(this);/TODO Auto-generated constructor stub protected void startApp()throws MIDletStateChangeException/TODO Auto-generated method stub Display.getDisplay(this).setCurrent(tb);protected void pauseApp()/TODO Auto-generated method stub protected void destroyApp(boolean arg0)throws MIDletStateChangeException/TODO Auto-generated method stub public void commandAction(Command c,Displayable d)if(c=exitCommand)try destroyApp(false);catch(MIDletStateChangeException e)notifyDestroyed();,import.*;import.*;public class HelloWorld extends MIDlet implements CommandListenerprivate Command exitCommand;private TextBox tb;public HelloWorld()exitCommand=new Command(退出,Command.EXIT,1);tb=new TextBox(你好!,J2ME,你好!,J2ME,15,0);tb.addCommand(exitCommand);tb.setCommandListener(this);/TODO Auto-generated constructor stubprotected void startApp()throws MIDletStateChangeException/TODO Auto-generated method stubDisplay.getDisplay(this).setCurrent(tb);protected void pauseApp()/TODO Auto-generated method stubprotected void destroyApp(boolean arg0)throws MIDletStateChangeException/TODO Auto-generated method stubpublic void commandAction(Command c,Displayable d)if(c=exitCommand)trydestroyApp(false);catch(MIDletStateChangeException e)notifyDestroyed();,编译器将使用midlet和lcdui两个类库包内定义的一些类,import.*;import.*;public class HelloWorld extends MIDlet implements CommandListenerprivate Command exitCommand;private TextBox tb;public HelloWorld()exitCommand=new Command(退出,Command.EXIT,1);tb=new TextBox(你好!,J2ME,你好!,J2ME,15,0);tb.addCommand(exitCommand);tb.setCommandListener(this);/TODO Auto-generated constructor stubprotected void startApp()throws MIDletStateChangeException/TODO Auto-generated method stubDisplay.getDisplay(this).setCurrent(tb);protected void pauseApp()/TODO Auto-generated method stubprotected void destroyApp(boolean arg0)throws MIDletStateChangeException/TODO Auto-generated method stubpublic void commandAction(Command c,Displayable d)if(c=exitCommand)trydestroyApp(false);catch(MIDletStateChangeException e)notifyDestroyed();,定义新类HelloWorld,告诉编译器它是MIDlet类子类,同时该类实现了CommandListener接口内定义的抽象 方法。,import.*;import.*;public class HelloWorld extends MIDlet implements CommandListenerprivate Command exitCommand;private TextBox tb;public HelloWorld()exitCommand=new Command(退出,Command.EXIT,1);tb=new TextBox(你好!,J2ME,你好!,J2ME,15,0);tb.addCommand(exitCommand);tb.setCommandListener(this);/TODO Auto-generated constructor stubprotected void startApp()throws MIDletStateChangeException/TODO Auto-generated method stubDisplay.getDisplay(this).setCurrent(tb);protected void pauseApp()/TODO Auto-generated method stubprotected void destroyApp(boolean arg0)throws MIDletStateChangeException/TODO Auto-generated method stubpublic void commandAction(Command c,Displayable d)if(c=exitCommand)trydestroyApp(false);catch(MIDletStateChangeException e)notifyDestroyed();,定义两个私有对象,tb是容器TextBox的对象;exitCommand是命令类型Command的对象,import.*;import.*;public class HelloWorld extends MIDlet implements CommandListenerprivate Command exitCommand;private TextBox tb;public HelloWorld()exitCommand=new Command(退出,Command.EXIT,1);tb=new TextBox(你好!,J2ME,你好!,J2ME,15,0);tb.addCommand(exitCommand);tb.setCommandListener(this);/TODO Auto-generated constructor stubprotected void startApp()throws MIDletStateChangeException/TODO Auto-generated method stubDisplay.getDisplay(this).setCurrent(tb);protected void pauseApp()/TODO Auto-generated method stubprotected void destroyApp(boolean arg0)throws MIDletStateChangeException/TODO Auto-generated method stubpublic void commandAction(Command c,Displayable d)if(c=exitCommand)trydestroyApp(false);catch(MIDletStateChangeException e)notifyDestroyed();,是个构造方法,import.*;import.*;public class HelloWorld extends MIDlet implements CommandListenerprivate Command exitCommand;private TextBox tb;public HelloWorld()exitCommand=new Command(退出,Command.EXIT,1);tb=new TextBox(你好!,J2ME,你好!,J2ME,15,0);tb.addCommand(exitCommand);tb.setCommandListener(this);/TODO Auto-generated constructor stubprotected void startApp()throws MIDletStateChangeException/TODO Auto-generated method stubDisplay.getDisplay(this).setCurrent(tb);protected void pauseApp()/TODO Auto-generated method stubprotected void destroyApp(boolean arg0)throws MIDletStateChangeException/TODO Auto-generated method stubpublic void commandAction(Command c,Displayable d)if(c=exitCommand)trydestroyApp(false);catch(MIDletStateChangeException e)notifyDestroyed();,启动方法!,import.*;import.*;public class HelloWorld extends MIDlet implements CommandListenerprivate Command exitCommand;private TextBox tb;public HelloWorld()exitCommand=new Command(退出,Command.EXIT,1);tb=new TextBox(你好!,J2ME,你好!,J2ME,15,0);tb.addCommand(exitCommand);tb.setCommandListener(this);/TODO Auto-generated constructor stubprotected void startApp()throws MIDletStateChangeException/TODO Auto-generated method stubDisplay.getDisplay(this).setCurrent(tb);protected void pauseApp()/TODO Auto-generated method stubprotected void destroyApp(boolean arg0)throws MIDletStateChangeException/TODO Auto-generated method stubpublic void commandAction(Command c,Displayable d)if(c=exitCommand)trydestroyApp(false);catch(MIDletStateChangeException e)notifyDestroyed();,暂停方法!,import.*;import.*;public class HelloWorld extends MIDlet implements CommandListenerprivate Command exitCommand;private TextBox tb;public HelloWorld()exitCommand=new Command(退出,Command.EXIT,1);tb=new TextBox(你好!,J2ME,你好!,J2ME,15,0);tb.addCommand(exitCommand);tb.setCommandListener(this);/TODO Auto-generated constructor stubprotected void startApp()throws MIDletStateChangeException/TODO Auto-generated method stubDisplay.getDisplay(this).setCurrent(tb);protected void pauseApp()/TODO Auto-generated method stubprotected void destroyApp(boolean arg0)throws MIDletStateChangeException/TODO Auto-generated method stubpublic void commandAction(Command c,Displayable d)if(c=exitCommand)trydestroyApp(false);catch(MIDletStateChangeException e)notifyDestroyed();,发生异常时退出方法!,import.*;import.*;public class HelloWorld extends MIDlet implements CommandListenerprivate Command exitCommand;private TextBox tb;public HelloWorld()exitCommand=new Command(退出,Command.EXIT,1);tb=new TextBox(你好!,J2ME,你好!,J2ME,15,0);tb.addCommand(exitCommand);tb.setCommandListener(this);/TODO Auto-generated constructor stubprotected void startApp()throws MIDletStateChangeException/TODO Auto-generated method stubDisplay.getDisplay(this).setCurrent(tb);protected void pauseApp()/TODO Auto-generated method stubprotected void destroyApp(boolean arg0)throws MIDletStateChangeException/TODO Auto-generated method stubpublic void commandAction(Command c,Displayable d)if(c=exitCommand)trydestroyApp(false);catch(MIDletStateChangeException e)notifyDestroyed();,事件处理,第一个MIDlet程序,LCDUI:LimitedConfigurationDeviceUI 有限设备配置用户界面包所有MIDlet程序都必须继承,它定义有允许应用管理软件创建、运行、停止和销毁应用程序的一些方法。,第一个MIDlet程序,exitCommand是命令类型Command的对象。Command类定义了所有按键动作和组件动作,它必须与CommandListener接口配合使用才能截获并处理用户的动作。commandAction()方法是事件处理的中枢,它将接受各种命令,并对其进行分析,再分别调用合适的处理方法。,MIDlet程序基本框架,MIDlet是J2ME的一个Java类,import.*;import.*;public class HelloWorld extends MIDletpublic HelloWorld()protected void startApp()protected void pauseApp()protected void destroyApp(boolean arg0),MIDlet的基本结构,MIDlet的生命周期,本章小结,J2ME的概念、CLDC、MIDP与KVM;J2ME开发平台构建;MIDlet的开发流程;MIDlet的生命周期;MIDlet的程序结构。,

    注意事项

    本文(J2ME游戏开发第一章.ppt)为本站会员(小飞机)主动上传,三一办公仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知三一办公(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    备案号:宁ICP备20000045号-2

    经营许可证:宁B2-20210002

    宁公网安备 64010402000987号

    三一办公
    收起
    展开