Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 14 Various MIDlet examples Rob Pooley

Slides:



Advertisements
Similar presentations
Introduction to Computers Section 6A. home The Operating System (OS) The operating system (OS) is software that controls the interaction between hardware.
Advertisements

MIDP Mobile Information Device Profile Johnny Yau CIS 642 Prof. Insup Lee.
Lesson 10: Starting Windows Applications start an application program move between open application programs start an application using the Run command.
Using Eclipse. Getting Started There are three ways to create a Java project: 1:Select File > New > Project, 2 Select the arrow of the button in the upper.
COMPREHENSIVE Windows Tutorial 3 Personalizing Your Windows Environment.
Writing Your First MIDlet Running JAVA on a Cell Phone Jon A. Batcheller January 27, 2004.
Introduction to Java 2 Micro Edition Mark Balbes, Ph.D. Senior Software Engineer Jeff Brown Senior Software Engineer.
Developing an Application with J2ME Technology Scott Palmer, Nat Panchee, Judy Sullivan, Karen Thabet, Sten Westgard.
J2ME for Palm Speaker: Chen-Nien Tsai Adviser: Kai-Wei Ke.
Introduction to Mobility Java Technology Mobile and Wireless Networks.
Copyright 2007, Paradigm Publishing Inc. POWERPOINT 2007 CHAPTER 1 BACKNEXTEND 1-1 LINKS TO OBJECTIVES Create Presentation Open, Save, Run, Print, Close,Delete.
Exploring the Basics of Windows XP. Objectives Start Windows XP and tour the desktop Explore the Start menu Run software programs, switch between them,
Making Cell Phone Games An Overview Ray Ratelis Guild Software, Inc.
Developing J2ME Applications Mobile and Wireless Networks.
A Visual Introduction to PC SAS. Start SAS by double-clicking on the SAS icon...
Java 2 Platform, Micro Edition (J2ME) By Xiaorong Wang.
J2ME and WAP Technologies CSCI – Independent Study Fall 2002 Presented by: Kashif Syed.
© 2010 IBM Corporation IBM Experience Modeler - Theme Editor Installing Python Image Library Presenter’s Name - Presenter’s Title DD Month Year.
Exploring the Basics of Windows XP
Programming Task: Task 1 Controlled Assessment Practice.
Getting Started with Adobe Photoshop CS6
Windows Tutorial 9 Maintaining Hardware and Software
Digital Image Processing Lecture3: Introduction to MATLAB.
J2ME Java for Mobile Environments Based on J2ME In A Nutshell, by Kim Topley, O’Reilly & Associates Inc., 2002, and Tetris by Alexei Patinov.
An Introduction to the Java ME Project Jens A Andersson.
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 12 Using the KToolbar Rob Pooley
I Can… Define basic file management and related terms Identify levels of a file system Identify and explain ways to view files in Windows OS Explain the.
Platforms and tools for Web Services and Mobile Applications J2ME based Applications Bent Thomsen Aalborg University 3rd and 4th of June 2004.
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 11 J2ME and MIDlets Rob Pooley
CIM6400 CTNW (04/05) 1 CIM6400 CTNW Lesson 6 – More on Windows 2000.
Tutorial 121 Creating a New Web Forms Page You will find that creating Web Forms is similar to creating traditional Windows applications in Visual Basic.
WindowsXP Explorer The Explorer is a used to organize and control the files and folders of the different storage systems such as the hard drive, floppy.
© 2011 Delmar, Cengage Learning Chapter 16 Annotating and Automating an Image.
Working with Symbols and Interactivity
Alice 2.0 Introductory Concepts and Techniques Project 1 Exploring Alice and Object-Oriented Programming.
PC Maintenance: Preparing for A+ Certification Chapter 23: Using a Windows Network.
© 2005 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Data Structures for Java William H. Ford William R. Topp Appendix E The EZJava.
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 12 lcdui Rob Pooley
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 23 Summing up Rob Pooley
Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment.
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 13 lcdui and OXO Rob Pooley
Computing Fundamentals Module Lesson 3 — Changing Settings and Customizing the Desktop Computer Literacy BASICS.
© Paradigm Publishing Inc. MICROSOFT WINDOWS XP MAINTAINING FILES AND CUSTOMIZING WINDOWS Section 2.
Introduction to Eclipse CSC 216 Lecture 3 Ed Gehringer Using (with permission) slides developed by— Dwight Deugo Nesa Matic
© 2006 Palm, Inc. All worldwide rights reserved. Note Pad application Digging Deeper.
Chapter Two Creating a First Project in Visual Basic.
Introduction to Web Services. Examples Using a Web Service Creating a new Web Service.
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 19 MIDlet to Palm Rob Pooley
Adobe Flash CS4 – Illustrated Unit A: Getting Started with Adobe Flash.
Java Programming, Second Edition Appendix A Working with Java SDK 1.4.
Getting Started with Word & Saving Guided Lesson.
Adding Text and Navigation to the Home Page – Lesson 51 Adding Text and Navigation to the Home Page Lesson 5.
Chapter 1 Getting Started with Adobe Photoshop CS4.
Basics of Windows 95/98/NT. Versions of Windows Windows 95 and 98 used mainly on standalone computers Windows NT used on networked computers (as in our.
1 Introduction to J2ME Outline MIDP Building J2ME Apps- Tool J2ME Wireless Toolkit Demo MIDlet Programming -- MIDlet Transition States -- Midlet Skeleton.
Data-information stored in files on the disks and CDs in your computer system Why should we save a file when we create it on the computer?
Create FormsCreate Forms Lesson 5 © 2014, John Wiley & Sons, Inc.Microsoft Official Academic Course, Microsoft Access Microsoft Access 2013.
CSE403: MIDlets and Ant1 MIDlets and Ant April 3, 2003 Shane Cantrell Zach Crisman.
An Introduction to Programming with C++1 An Introduction to Control Structures Tutorial 1.
Advance Computer Programming Market for Java ME The Java ME Platform – Java 2 Micro Edition (J2ME) combines a resource- constrained JVM and a set of Java.
FIRST COURSE Exploring the Basics of Microsoft Windows Vista.
Chapter 2 – Introduction to Windows Operating System II Manipulating Windows GUI 1CMPF112 Computing Skills for Engineers.
Java N Amanquah.
J2ME Command Class.
J2ME User Interface I.
Microsoft Windows 7 Basics
Shane Cantrell Zach Crisman
Java for Mobile Devices
Microsoft Windows 7 Basics
Presentation transcript:

Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 14 Various MIDlet examples Rob Pooley

Programming Handheld and Mobile devices 2 Example of TextBox 1 /* * Based on HelloMIDlet.java from Sun Microsystems * Original Author: Srikanth Raju * Changed beyond recognition by Rob Pooley */ import javax.microedition.midlet.*; import javax.microedition.lcdui.*; /** * An example MIDlet with simple TextBoxes * These allow editing of an initial text * which is then displayed in a second TextBox. */ public class HelloMIDlet extends MIDlet implements CommandListener { private Display display; // The display for this MIDlet private TextBox t1, t2; Command cExit, cDone, cRestart; public HelloMIDlet() { display = Display.getDisplay(this); }

Programming Handheld and Mobile devices 3 Example of TextBox 2 /** * Start up the Hello MIDlet by creating the first TextBox */ public void startApp() { t1 = new TextBox("Hello Heriot Watt", "We like Saturday!", 256, 0); cExit = new Command("Exit",Command.EXIT,0); t1.addCommand(cExit); cDone = new Command("Done",Command.OK,0); t1.addCommand(cDone); t1.setCommandListener(this); display.setCurrent(t1); } /** * Pause is a no-op since there are no background activities or * record stores that need to be closed. */ public void pauseApp() { } /** * Destroy must cleanup everything not handled by the garbage collector. * In this case there is nothing to cleanup. */ public void destroyApp(boolean unconditional) { }

Programming Handheld and Mobile devices 4 Example of TextBox 3 public void commandAction(Command c, Displayable d) { switch(c.getCommandType()) { case Command.EXIT: notifyDestroyed(); break; case Command.OK: t2 = new TextBox(t1.getString(), "Oh yes we do!", 256, 0); cRestart = new Command("Return",Command.BACK,0); t2.addCommand(cRestart); t2.setCommandListener(this); display.setCurrent(t2); break; case Command.BACK: startApp(); break; default: break; }

Programming Handheld and Mobile devices 5 Example of Alert 1 /* * * Changed beyond recognition by Rob Pooley */ import javax.microedition.midlet.*; import javax.microedition.lcdui.*; /** * An example MIDlet with simple Alerts * These allow display of an initial text and simple drawing */ public class AlertExample extends MIDlet implements CommandListener { private Display display; // The display for this MIDlet private Alert a1, a2; Command cExit, cDone, cRestart; Image i1,i2;

Programming Handheld and Mobile devices 6 Example of Alert 2 public AlertExample() { display = Display.getDisplay(this); } /** * Start up the Hello MIDlet by creating the first Alert */ public void startApp() { i1 = Image.createImage(30,30); Graphics g = i1.getGraphics(); g.drawLine(0,0,10,10); g.drawArc(10,10,10,10,0,360); a1 = new Alert("Hello Heriot Watt", "We like Saturday!", i1, AlertType.INFO); cExit = new Command("Exit",Command.EXIT,0); a1.addCommand(cExit); cDone = new Command("Done",Command.OK,0); a1.addCommand(cDone); a1.setCommandListener(this); display.setCurrent(a1); }

Programming Handheld and Mobile devices 7 Example of Alert 3 /** * Pause is a no-op since there are no background activities */ public void pauseApp() { } /** * In this case there is nothing to cleanup. */ public void destroyApp(boolean unconditional) { } public void commandAction(Command c, Displayable d) { switch(c.getCommandType()) { case Command.EXIT: notifyDestroyed(); break; case Command.OK: a2 = new Alert("Oh yes we do!"); cRestart = new Command("Return",Command.BACK,0); a2.addCommand(cRestart); a2.setCommandListener(this); display.setCurrent(a2); break; case Command.BACK: startApp(); break; default: break; }

Programming Handheld and Mobile devices 8 Example of List 1 import javax.microedition.midlet.*; import javax.microedition.lcdui.*; /** * An example MIDlet with simple Lists * These allow display of a selectable menu of strings */ public class ListExamp extends MIDlet implements CommandListener { private Display display; // The display for this MIDlet private List l1, l2; Command cExit, cDone, cRestart, cSend, cLeave; Image i1,i2; public ListExamp() { display = Display.getDisplay(this); }

Programming Handheld and Mobile devices 9 Example of List 2 /** * Start up the Hello MIDlet by creating the first TextBox */ public void startApp() { l1 = new List("Hello Heriot Watt",List.IMPLICIT); cExit = new Command("Exit",Command.EXIT,0); l1.addCommand(cExit); cDone = new Command("Done",Command.OK,0); l1.addCommand(cDone); cSend = new Command("Send",Command.SCREEN,0); l1.addCommand(cSend); cLeave = new Command("Leave",Command.SCREEN,0); l1.addCommand(cLeave); l1.setCommandListener(this); display.setCurrent(l1); }

Programming Handheld and Mobile devices 10 Example of List 3 /** * Pause is a no-op since there are no background activities or * record stores that need to be closed. */ public void pauseApp() { } /** * Destroy must cleanup everything not handled by the garbage collector. * In this case there is nothing to cleanup. */ public void destroyApp(boolean unconditional) { } public void commandAction(Command c, Displayable d) { switch(c.getCommandType()) { case Command.EXIT: notifyDestroyed(); break; case Command.OK: l2 = new List("Oh yes we do!",List.EXCLUSIVE); cRestart = new Command("Return",Command.BACK,0); l2.addCommand(cRestart); l2.setCommandListener(this); display.setCurrent(l2); break; case Command.BACK: startApp(); break; case Command.SCREEN: if(c.getLabel()==“Leave") notifyDestroyed(); else { Alert a1 = new Alert("Leave","Now please",null,AlertType.ERROR); display.setCurrent(a1); } break; default: break; }

Programming Handheld and Mobile devices 11 Example of Complex Form 1 public class CompForm extends MIDlet implements CommandListener { private Display display; // The display for this MIDlet private Form f1, f2; Command cExit, cDone, cRestart; Image i1,i2; ImageItem ii1, ii2; TextField b1, b2; public CompForm() { display = Display.getDisplay(this); } /** * Start up the Hello MIDlet by creating the Form */ public void startApp() { i1 = Image.createImage(30,30); Graphics g = i1.getGraphics(); g.drawLine(0,0,10,10); g.drawArc(10,10,10,10,0,360); i2 = Image.createImage(i1); ii1 = new ImageItem("Picture",i2,ImageItem.LAYOUT_CENT ER,"Lopsided lolly"); b1 = new TextField("text sample"," ",256,TextField.NUMERIC); f1 = new Form("Hello Heriot Watt"); cExit = new Command("Exit",Command.EXIT,0); f1.addCommand(cExit); cDone = new Command("Done",Command.OK,0); f1.addCommand(cDone); f1.setCommandListener(this); f1.append(ii1); f1.append(b1); display.setCurrent(f1); }

Programming Handheld and Mobile devices 12 Example of Complex Form 2 /** * Pause is a no-op since there are no background activities or * record stores that need to be closed. */ public void pauseApp() { } /** * Destroy must clean up everything not handled by the garbage collector. * In this case there is nothing to clean up. */ public void destroyApp(boolean unconditional) { }

Programming Handheld and Mobile devices 13 Example of Complex Form 3 public void commandAction(Command c, Displayable d) { switch(c.getCommandType()) { case Command.EXIT: notifyDestroyed(); break; case Command.OK: f2 = new Form("Oh yes we do!"); cRestart = new Command("Return",Command.BACK,0); f2.addCommand(cRestart); f2.setCommandListener(this); display.setCurrent(f2); break; case Command.BACK: startApp(); break; default: break; }

Programming Handheld and Mobile devices 14 Complex form in use

Programming Handheld and Mobile devices 15 Moving MIDlets There are two parts to installing MIDP for Palm OS. You must install the MIDP for Palm OS package on your desktop computer, and you must install the MIDP for Palm OS implementation (Java™ HQ) on your Palm OS device.

Programming Handheld and Mobile devices 16 Result of the Installation Installing the MIDP for Palm OS implementation adds the following icon to your device’s home screen:

Programming Handheld and Mobile devices 17 Example of TextBox 3

Programming Handheld and Mobile devices 18 Running applications written in Java This screen contains a copyright notice and a Preferences button. Tapping the Preferences button gives you the option to change the MIDP for Palm OS global preferences. This screen also provides help (a “tip”) if you tap the icon. Java™ HQ cannot launch Java applications. You run a Java application by tapping the application’s icon.

Programming Handheld and Mobile devices 19 Installing Java Applications A Java application written for MIDP is distributed as a pair of files, –one with a.jar extension and –the other with a.jad extension. Other than their extensions, the files have the same name. –For example, a poker Java application would be distributed as the files Poker.jar and Poker.jad.

Programming Handheld and Mobile devices 20 Converting You must convert it to a Palm OS application before you can install it. A PalmOS application is a file that has a.prc extension. You use the Convertor tool to do this.

Programming Handheld and Mobile devices 21 Packaging a Java application The KToolBar will package your Java MIDlet Select the Project menu Then select Package from that menu Then select Create Package from that menu The Package is created as a.jar and.jad pair in the bin folder of the project

Programming Handheld and Mobile devices 22 Convertor If your computer is configured to run JAR files directly, you could double-click on the Converter.jar file.

Programming Handheld and Mobile devices 23 To Change JAR/JAD Files Into a PRC File 1. Make sure the JAR and JAD file are in the same directory. 2. If the PRC Converter Tool is not running, start it. A window similar to the one in the following figure will appear:

Programming Handheld and Mobile devices 24 Using the tool 3. Click the PRC Converter Tool’s Folder button ( ), or choose Convert from its File menu. A dialog box similar to this 4. Navigate to the directory where the JAD and JAR files are located.

Programming Handheld and Mobile devices Select a JAD file to convert. The JAD info panel shows you information about the Java application. Note that if your desktop computer system supports selecting multiple files in dialog boxes, you can select multiple JAD files to convert. 6. Click the Convert button to convert the JAR/JAD file pair to a PRC. (Clicking Convert does not affect the original JAR/JAD files; it merely creates a new file with a.prc extension.)

Programming Handheld and Mobile devices 26 Multiple MIDP for Palm OS Icons on Palm OS Device