J2ME程序设计实例教程(第02章)
- 格式:ppt
- 大小:86.50 KB
- 文档页数:28
《J2ME程序设计》课程教学大纲一、课程基本情况开课单位:计算机与信息工程系课程编码:适用专业:软件修课方式:必须总学时:68学时考核方式:考试教材:《J2ME移动应用开发》郝玉龙北方交通大学出版社 2006.9教学参考书:《精通J2ME无线编程》,林胜利,中国铁道出版社,2004年二、课程的性质、任务和目的本课程是计算机软件专业的一门专业基础课程,重在培养学生的移动设备实践开发能力,适应软件企业的工作环境和业界标准,并和国际先进的软件开发理念保持同步。
通过本课程学习,学生应该了解并掌握J2ME技术基础,CLDC与MIDP基本概念,熟练应用J2ME技术开发基于移动设备的应用系统或游戏系统,并了解移动增值业务系统的开发基础。
学习本课程学生应达到如下要求或能力:1、掌握J2ME技术基础以及CLDC与MIDP的基本概念2、熟练应用J2ME技术编写简单应用软件系统3、熟练应用J2ME技术编写简单游戏4、了解无线增值业务(如SMS)应用系统的开发三、课程的主要内容和学时分配(一) 主要内容第1章 J2ME概述 2学时1.1 J2ME简介1.2 J2ME架构1.3 技术规范第2章 Hello World 2+2学时2.1 第一个实例2.2 J2ME程序开发流程2.3 代码解释2.4 JBuilder 9的配置2.5 使用JBuilder 9开发Hello World第3章 MIDlet和MIDlet Suite 4+2学时3.1 MIDlet概述3.2 MIDlet的打包3.3 MIDlet的生命周期3.4 MIDlet的安全管理第4章 MIDP用户界面——高级API 6+2学时4.1 MIDP用户界面概述4.2 高级API详述4.3 开发实用程序第5章 MIDP用户界面库——底层API 8+4学时5.1 Canvas类概述5.2 设备及屏幕属性5.3 基本作图属性设置5.4 基本图形操作5.5 剪切区操作5.6 输入处理5.7 多线程5.8 定制Item5.9 开发实用程序第6章 MIDP游戏编程 6+4学时 6.1 游戏API概述6.2 GameCanvas类6.3 LayerManager和Layer6.4 Sprite6.5 TiledLayer6.6 游戏设计第7章 MIDP网络编程 8+4学时 7.1 通用连接框架7.2 输入输出流7.3 HTTP协议7.4 使用HttpConnection编程7.5 Socket编程7.6 无线消息传递7.7 PushRegistry7.8 网络安全和MIDlet的签名认证第8章永久存储 4+2学时 8.1 永久存储概述8.2 RMS基础8.3 账务管理程序附录A J2ME开发基本环境设置 2+2学时 A.1 获取软件包A.2 软件包安装与配置A.3 J2ME网络资源附录B CLDC概述 2+2学时 B.1 CLDC的目标和功能B.2 CLDC 1.1与CLDC 1.0的区别B.3 CLDC的安全要求B.4 CLDC中虚拟机的变化B.5 CLDC中的类库附录C MIDP概述 2+2学时 C.1 MIDP的范围和软硬件要求C.2 MIDP的包概述C.3 MIDP的部署-Over-The-Air (OTA)C.4 MIDP程序的效率Borland认证课程介绍(二) 学时分配四、课程教学基本要求及重点1.J2ME概述了解J2ME的基本概念,开发架构以及采用的规范,掌握J2ME开发所需基本条件以及开发环境所需软件基础。
J2ME移动应用开发课程设计1. 简介随着移动互联网的飞速发展,移动应用的重要性越来越突出。
Java平台微型版(Java 2 Platform, Micro Edition, J2ME)是一种专门针对嵌入式设备制定的Java平台,可用于开发移动设备上的Java应用程序。
本课程设计旨在介绍J2ME 移动应用开发的基础理论和实践技术,帮助学生熟悉J2ME平台,掌握常用的应用程序开发技术,提升移动应用开发水平。
2. 学习目标1.了解J2ME平台的基础知识和发展历程。
2.熟悉J2ME开发环境的配置和使用。
3.掌握J2ME移动应用程序的基本开发技术。
4.能够开发一个简单的J2ME移动应用程序。
3. 课程安排3.1 第一周:J2ME平台介绍主要内容:J2ME平台概述、J2ME体系结构、J2ME应用程序类型、J2ME与J2SE 的区别与联系。
3.2 第二周:J2ME开发环境搭建主要内容:J2ME开发环境介绍、J2ME IDE Eclipse的安装与配置、J2ME手机模拟器的安装与使用、J2ME开发的准备工作。
3.3 第三周:J2ME应用程序开发基础主要内容:J2ME应用程序的结构、J2ME应用程序的生命周期、J2ME界面设计与事件处理、J2ME应用程序的调试与测试。
3.4 第四周:J2ME应用程序开发实践主要内容:基于J2ME平台的应用程序开发实践,包括聊天室、计算器、迷宫游戏等。
3.5 第五周:课程总结与展望主要内容:对本课程进行总结,回顾学习内容,展望J2ME应用程序开发的前景和发展。
4. 课程设计要求1.学生需要在规定时间内完成J2ME应用程序开发的任务,提交所开发应用程序的源代码和应用程序截图。
2.学生需要在课堂上积极参与讨论、提问和答辩环节,了解和掌握相关知识和技能。
3.学生需要在考核环节中完成J2ME应用程序的演示和答辩,展示自己的学习成果。
5. 参考文献1.《J2ME移动应用开发实践》(高文华等著)2.《Java平台微型版Java ME程序设计》(徐鸿义等著)3.《J2ME入门经典》(曹天元等著)。
上机实验二 简单MIDP程序的创建与调试 3.18[实验目的]完成简单MIDP程序的创建与调试过程,熟悉在Netbeans环境下进行JavaMEMIDP程序开发的基本方法与步骤。
[实验内容]1、创建一个名为Hello的MIDP项目,设备配置使用CLDC1.1,设备配置文件使用MIDP 2.0,设备模拟器直接使用默认的彩屏手机模拟器。
2、在Hello项目中创建一个名为HelloMidlet的MIDlet程序 (源程序见附录部分)。
3、生成该程序,在电脑中对其进行测试运行。
4、通过数据线或其它方法将该程序拷贝到自己的手机中,在手机中试运行该程序。
[实验步骤]1、创建程序2、测试运行程序3、将程序发布到手机中运行/** To change this template, choose Tools | Templates* and open the template in the editor.*/package hello;import javax.microedition.midlet.*;import javax.microedition.lcdui.*;/*** @author yangyan*/public class HelloMIDlet extends MIDlet implements CommandListener {private boolean midletPaused = false;private TextBox text;//<editor-fold defaultstate="collapsed" desc=" Generated Fields ">private Command exitCommand;private Form form;private StringItem stringItem;//</editor-fold>/*** The HelloMIDlet constructor.*/public HelloMIDlet() {text=new TextBox("Hello", "Hello World", 30, TextField.ANY);exitCommand = new Command("Exit", Command.EXIT, 1);text.addCommand(exitCommand);text.setCommandListener(new CommandListener() {public void commandAction(Command cmd, Displayable disp) {destroyApp(true);notifyDestroyed();}});}//<editor-fold defaultstate="collapsed" desc=" Generated Methods ">//</editor-fold>//<editor-fold defaultstate="collapsed" desc=" Generated Method: initialize ">/*** Initilizes the application.* It is called only once when the MIDlet is started. The method is called before the <code>startMIDlet</code> method.*/private void initialize() {// write pre-initialize user code here// write post-initialize user code here}//</editor-fold>//<editor-fold defaultstate="collapsed" desc=" Generated Method: startMIDlet ">/*** Performs an action assigned to the Mobile Device - MIDlet Started point.*/public void startMIDlet() {// write pre-action user code hereswitchDisplayable(null, getForm());// write post-action user code here}//</editor-fold>//<editor-fold defaultstate="collapsed" desc=" Generated Method: resumeMIDlet ">/*** Performs an action assigned to the Mobile Device - MIDlet Resumed point.*/public void resumeMIDlet() {// write pre-action user code here// write post-action user code here}//</editor-fold>//<editor-fold defaultstate="collapsed" desc=" Generated Method: switchDisplayable ">/*** Switches a current displayable in a display. The <code>display</code> instance is taken from <code>getDisplay</code> method. This method is used by all actions in the design for switching displayable.* @param alert the Alert which is temporarily set to the display; if <code>null</code>, then <code>nextDisplayable</code> is set immediately* @param nextDisplayable the Displayable to be set*/public void switchDisplayable(Alert alert, Displayable nextDisplayable) {// write pre-switch user code hereDisplay display = getDisplay();if (alert == null) {display.setCurrent(nextDisplayable);} else {display.setCurrent(alert, nextDisplayable);}// write post-switch user code here}//</editor-fold>//<editor-fold defaultstate="collapsed"desc="Generated Method:commandAction for Displayables ">/*** Called by a system to indicated that a command has been invoked on a particular displayable.* @param command the Command that was invoked* @param displayable the Displayable where the command was invoked*/public void commandAction(Command command, Displayable displayable) { // write pre-action user code hereif (displayable == form) {if (command == exitCommand) {// write pre-action user code hereexitMIDlet();// write post-action user code here}}// write post-action user code here}//</editor-fold>//<editor-fold defaultstate="collapsed" desc=" Generated Getter: exitCommand "> /*** Returns an initiliazed instance of exitCommand component.* @return the initialized component instance*/public Command getExitCommand() {if (exitCommand == null) {// write pre-init user code hereexitCommand = new Command("Exit", Command.EXIT, 0);// write post-init user code here}return exitCommand;}//</editor-fold>//<editor-fold defaultstate="collapsed" desc=" Generated Getter: form ">/*** Returns an initiliazed instance of form component.* @return the initialized component instance*/public Form getForm() {if (form == null) {// write pre-init user code hereform = new Form("Welcome", new Item[] { getStringItem() });form.addCommand(getExitCommand());form.setCommandListener(this);// write post-init user code here}return form;}//</editor-fold>//<editor-fold defaultstate="collapsed" desc=" Generated Getter: stringItem ">/*** Returns an initiliazed instance of stringItem component.* @return the initialized component instance*/public StringItem getStringItem() {if (stringItem == null) {// write pre-init user code herestringItem = new StringItem("Hello", "Hello, World!");// write post-init user code here}return stringItem;}//</editor-fold>/*** Returns a display instance.* @return the display instance.*/public Display getDisplay () {return Display.getDisplay(this);}/*** Exits MIDlet.*/public void exitMIDlet() {switchDisplayable (null, null);destroyApp(true);notifyDestroyed();}/*** Called when MIDlet is started.* Checks whether the MIDlet have been already started and initialize/starts or resumes the MIDlet.*/public void startApp() {if (midletPaused) {resumeMIDlet ();} else {initialize ();startMIDlet ();}midletPaused = false;}/*** Called when MIDlet is paused.*/public void pauseApp() {midletPaused = true;}/*** Called to signal the MIDlet to terminate.* @param unconditional if true, then the MIDlet has to be unconditionally terminated and all resources has to be released.*/public void destroyApp(boolean unconditional) {}}。
J2ME手机游戏开发技术与实践课程设计一、课程设计目标本课程设计旨在培养学生对J2ME(Java 2 Mobile Edition)手机游戏开发技术的理解与实践能力,帮助学生了解J2ME游戏开发的基本理论和技术要点,掌握J2ME游戏开发所需的工具和平台环境,并能独立完成一个小型的J2ME手机游戏开发项目。
二、课程设计内容1. J2ME介绍本课程将首先介绍J2ME的基本概念和特点,分析其在手机游戏开发中的优势和不足。
2. J2ME游戏开发工具本课程将介绍J2ME游戏开发所需的工具和平台环境,包括Eclipse集成开发环境、J2ME Wireless Tool Kit、Java SDK、Java ME Platform SDK等,让学生熟练掌握J2ME游戏开发所需的开发工具和平台环境。
3. J2ME游戏开发基础本课程将讲解J2ME游戏开发的基础知识,包括如何创建一个J2ME游戏工程、如何实现游戏的图像显示、声音播放、触屏控制等功能的实现。
4. J2ME游戏实例分析本课程将分析一些经典的J2ME游戏实例,帮助学生理解J2ME游戏开发的实现方法和技巧,同时学生将根据这些实例进行一些小型游戏的开发。
5. J2ME游戏上线和营销课程最后将介绍移动设备游戏的上线和营销策略,包括如何通过各种渠道发布和推广自己的J2ME游戏,为学生未来从事移动游戏开发,为自己的游戏营销提供参考和指导。
三、课程设计任务完成一个小型的J2ME手机游戏开发项目,完成以下步骤:1.案例选取:根据个人兴趣选定一款适合J2ME平台的游戏作为本次课程设计的开发对象。
2.游戏设计:使用MindManager或其他思维导图工具,完成游戏设计文档(GDD),包括游戏说明、界面设计、关卡设计、声音和特效设计、游戏规则等内容。
3.开始开发:在Eclipse中创建一个新的J2ME工程,按照游戏设计文档中的设计实现游戏主体框架,并逐步实现游戏的各种功能。
4.测试调试:完成游戏基本功能开发后,需要进行测试和调试,确保游戏运行正常,没有不良后果和内存泄露等问题。