80 likes | 122 Views
J2ME -- Introduction. Introduction / Overview Java 2 Micro Edition CLDC MIDP Examples. 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)
E N D
J2ME -- Introduction Introduction / Overview Java 2 Micro Edition CLDC MIDP Examples
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, DataOutputStream ByteArrayInputStream, ByteArrayOutputStream InputStreamReader, OutputStreamReader PrintStream Reader Writer • exception, error classes etc
J2ME -- CLDC • The Connected Limited Device Configuration (CLDC) • Package java.lang contains • interface Runnable • classes Boolean Byte Character Class Integer Long Math Object Runtime Short String StringBuffer System Thread Throwable • Package java.util contains • interface Enumeration • classes Calendar Data Hashtable Random Stack Timer TimerTask 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
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 CommandListener ItemListener • classes Alert AlertType Canvas ChoiceGroup Command DataField Display Displayable Font Form Gauge Graphics Image ImageItem Item List Screen ScreenItem TextBox TextField Ticker
J2ME -- MIDP • The Mobile Information Device Profile (ctd) • Package javax.microedition.io contains support for networking - • interfaces Connection ContentConnection Datagram DatagramConnection HttpConnection InputConnection OutputConnection StreamConnection StreamConnectionNotifier • class Connector
J2ME -- MIDP • The Mobile Information Device Profile • Package javax.microedition.rms contains support for local storage - • interfaces RecordComparitor RecordEnumeration RecordFilter 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
Graphics in a MIDlet <<interface>>javax.microediiton.lcdui.Displayable <<abstract>> Canvas <<abstract>> Screen (high-level) (low-level) Alert TextBox List Form • 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
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