Michael Brockway
Advanced Applications Development in Java
J2ME -- Introduction
Introduction / Overview Java 2 Micro Edition
CLDC MIDP
Examples
2
Java 2 Micro Edition -- CLDC
A version of the Java platform which supports small devices -- hand-helds, cell phones, pagers, embedded systems, ...
The Connected Limited Device Configuration (CLDC) a set of APIs for applications for devices with limited screens size, memory,
power, bandwidth. Contains the kilobyte virtual machine (KVM) packages java.io, java.lang, java.util
small subsets of the corresponding J2SE packages See java.sun.com/j2me/docs/pdf/cldcapi.pdf for details Package java.io contains
interfaces DataInput, DataOutput classes InputStream, OutputStream
DataInputStream, DataOutputStreamByteArrayInputStream, ByteArrayOutputStreamInputStreamReader, OutputStreamReaderPrintStreamReader Writer
exception, error classes etc
3
J2ME -- CLDC
The Connected Limited Device Configuration (CLDC) Package java.lang contains
interface Runnable classes Boolean Byte Character Class
Integer Long Math ObjectRuntime Short String StringBuffer
System Thread Throwable Package java.util contains
interface Enumeration classes Calendar Data Hashtable
Random Stack TimerTimerTask TimeZone Vector
CLDC version 1.0 contained no floating point types, no serializable objects no thread groups no JNI
CLDC 1.1 which appeared in March 2004 contains more features, including floating point arithmetic support
4
J2ME -- MIDP
The Mobile Information Device Profile APIs for programming mobile devices -- phones, Palm Pilots, ...
Application software in MIDlets
Package javax.microedition.lcdui contains GUI classes for devices with LCD screens
interfaces Choice CommandListenerItemListener
classes Alert AlertType CanvasChoiceGroup
Command DataField Display Displayable
Font Form Gauge GraphicsImage ImageItem Item ListScreen ScreenItem TextBox TextFieldTicker
5
J2ME -- MIDP
The Mobile Information Device Profile (ctd)
Package javax.microedition.io contains support for networking - interfaces Connection ContentConnection
Datagram DatagramConnectionHttpConnection InputConnectionOutputConnection StreamConnection StreamConnectionNotifier
class Connector
6
J2ME -- MIDP
The Mobile Information Device Profile Package javax.microedition.rms contains support for local storage -
interfaces RecordComparitor RecordEnumerationRecordFilter RecordListener
class RecordStore
Package javax.microedition.midlet contains the MIDlet class
The minimum hardware for a MIDlet: at least 96 X 54 pixels monochrome display a two-way wireless network an input device 128 kb for CLDC & MIDP classes at least 32 kb for the KVM
7
Graphics in a MIDlet
<<interface>>javax.microediiton.lcdui.Displayable
<<abstract>> Screen
<<abstract>>Canvas
Alert TextBox List Form
(low-level)
(high-level)
Canvas is “low leve1” not a container, but we can override its paint method to use Graphics draw
methods Screen is “high level”
a container of laid-out components
8
Practicalities
Download the J2ME Wireless Toolkit from http://java.sun.com/products/j2mewtoolkit/index.html Install in Windows or Linux Documentation accompanies the software
Look at the tutorial material in http://developers.sun.com/techtopics/mobility/learn/ Especially MIDlet Life Cycle and Getting Started with MIDP.
Exercises Make a MIDlet which will display a multiplication table when an integer
between 1 and 12 is input. Make a MIDlet which will do simple (+, -, X, /) calculations on two input
numbers
Top Related