Cover image for Wireless Java

Book description

Learning Wireless Java is for Java developers who want to quickly come up to speed and create applications for the Micro Edition audience. This book covers the Connected, Limited Device Configuration and the Mobile Information Device Profile (MIDP), both currently available from Javasoft. The CLDC contains APIs for small devices that are constrained by both memory and processing power. MIDP builds on top of the CLDC and adds APIs specifically for devices such as mobile phones and pagers, allowing programmers to create MIDlet applications. This book offers a solid introduction to J2ME and MIDP, including an explanation of the J2ME Wireless Toolkit, the MIDlet lifecycle methods, the Java application manager, and the CLDC and MIDP constraints. In addition, we cover the javax.microedition.io, javax.microedition.rms, javax.microedition.lcdui, and javax.microedition.midlet classes, as well as the modified java.lang, java.io, and java.util classes. Discussion centers around building safe, compact applications with the sophisticated graphical interface, database, and networking capabilities that the J2ME supports. In addition, this book also shows you how to download your applications to the latest J2ME-enabled devices, including the Motorola i50x and i85s phones and upgraded Palm handhelds.

Table of Contents

  1. Wireless Java
    1. Preface
      1. Audience
      2. Contents of This Book
        1. Conventions Used in This Book
      3. Comments and Questions
      4. Acknowledgments
    2. I. Introducing Java 2 Platform, Micro Edition (J2ME)
      1. 1. Overview of J2ME
        1. What Is J2ME?
          1. A High-Level View
          2. Configurations
            1. The CDC
            2. The CLDC
          3. Virtual Machines
            1. The KVM
            2. The CVM
          4. Profiles
            1. The MIDP
            2. The PDA profile
            3. The Foundation profile
            4. The Personal profile
            5. The RMI profile
        2. Downloading the J2ME Wireless Toolkit
        3. A Simple Example
          1. A Login MIDlet
          2. Working with the Emulator
      2. 2. The Connected Limited Device Configuration (CLDC)
        1. Examining the CLDC in Detail
          1. What’s Different About the Java Virtual Machine?
          2. The KVM
            1. Class Verification
            2. Security
          3. What’s Different About the Core Java Libraries?
            1. Classes inherited from J2SE
            2. String and StringBuffer
            3. Runtime
            4. System
            5. Math
          4. What’s Different About I/O and Networking?
            1. The Generic Connection Framework
          5. Differences with Property Support in the CLDC
        2. Using the Standalone CLDC and KVM
        3. CLDC Next Generation
      3. 3. The Mobile InformationDevice Profile (MIDP)
        1. Mobile Information Devices
          1. Class Additions
          2. System Properties
        2. More About MIDlets
          1. What Is a MIDlet Suite?
            1. The JAR Manifest
          2. Java Application Descriptor (JAD)
          3. Programming Guidelines
            1. Performance
    3. II. Programming with the CLDCand the MIDP
      1. 4. Working with MIDlets
        1. The Application Manager
        2. Creating MIDlets
          1. Write the MIDlet
          2. Compile the Source Code
          3. Preverify the Class File
          4. Package the Application in a JAR File
          5. Create a JAD File
          6. Simplifying the Development
          7. Deploying MIDlets
            1. Deploying OTA
            2. Deploying to the Motorola i50x/i85s
      2. 5. MIDP GUI Programming
        1. Why Not Reuse the AWT?
        2. The MIDP GUI APIs
          1. The MIDP GUI Model
          2. The lcdui Package
        3. The High-Level MIDP APIs
          1. Working with Screens
            1. Display
            2. Screen
            3. Ticker
            4. TextBox
            5. Alert
            6. List
          2. Working with Forms
            1. Form
            2. Item
            3. ChoiceGroup
            4. DateField
            5. Gauge
            6. Image and ImageItem
            7. StringItem
            8. TextField
        4. Creating Low-Level GUI Components
          1. Drawing Graphics
          2. Double Buffering
          3. Threading Issues
          4. Fonts
          5. Guidelines for GUI Programming for MIDP Devices
      3. 6. MIDP Events
        1. Screen Navigation
          1. Commands
          2. The CommandListener Interface
            1. Handling simple events
            2. Creating GUI components and handling events
          3. The ItemStateListener Interface
            1. Changing the date
        2. Handling Low-Level Events
          1. Key Events
          2. Game Actions
          3. Event Delivery Methods
            1. Handling low-level events
      4. 7. Networking
        1. Generic Connections
        2. MIDP Connectivity
          1. The HttpConnection Interface
        3. The HTTP Programming Model
          1. Request Methods
          2. Servlets
        4. Invoking Remote Applications from MIDlets
          1. Fetching a Page
          2. Invoking a CGI Script (GET)
          3. Invoking a CGI Script (POST)
          4. Invoking a Servlet
            1. FirstMidletServlet
            2. SecondMidletServlet
        5. Wireless Session Tracking
        6. MIDlet Networking Security
      5. 8. Database Programming
        1. The Record Management System
          1. Record Stores
          2. The javax.microedition.rms Package
            1. Interfaces
            2. Classes
            3. Exceptions
        2. Programming with the RMS
          1. Opening, Closing, and Deleting a Record Store
          2. Creating and Modifying Records
          3. Filtering Records
          4. Comparing Records
          5. Enumerating Records
          6. Listening to Record Stores
          7. A Stock Database
            1. The Stock.java Class
            2. The StockDB.java Class
            3. The QuotesMIDlet.java Class
          8. Testing QuotesMIDlet
      6. 9. The MIDP for Palm OS
        1. Installing the MIDP for Palm OSon the Windows Platform
          1. Installing the MIDP for Palm OS on the Device
          2. Running Sample Applications
        2. Developing New Applications
          1. Develop a MIDlet
          2. Convert a MIDlet into a PRC file
          3. Install and Test
        3. PRC Command-Line Conversion
        4. Advanced Java Applications
          1. Fetching a Page Using HttpConnection
          2. Retrieving Stock Quotes and Working with Databases
        5. A Final Thought
    4. III. API Quick Reference
      1. A. The java.io Package
        1. java.io.ByteArrayInputStream
        2. java.io.ByteArrayOutputStream
        3. java.io.DataInput
        4. java.io.DataInputStream
        5. java.io.DataOutput
        6. java.io.DataOutputStream
        7. java.io.EOFException
        8. java.io.InputStream
        9. java.io.InputStreamReader
        10. java.io.InterruptedIOException
        11. java.io.IOException
        12. java.io.OutputStream
        13. java.io.OutputStreamWriter
        14. java.io.PrintStream
        15. java.io.Reader
        16. java.io.UnsupportedEncodingException
        17. java.io.UTFDataFormatException
        18. java.io.Writer
      2. B. The java.lang Package
        1. java.lang.ArithmeticException
        2. java.lang.ArrayIndexOutOfBoundsException
        3. java.lang.ArrayStoreException
        4. java.lang.Boolean
        5. java.lang.Byte
        6. java.lang.Character
        7. java.lang.Class
        8. java.lang.ClassCastException
        9. java.lang.ClassNotFoundException
        10. java.lang.Error
        11. java.lang.Exception
        12. java.lang.IllegalAccessException
        13. java.lang.IllegalArgumentException
        14. java.lang.IllegalMonitorStateException
        15. java.lang.IllegalStateException
        16. java.lang.IllegalThreadStateException
        17. java.lang.IndexOutOfBoundsException
        18. java.lang.InstantiationException
        19. java.lang.Integer
        20. java.lang.InterruptedException
        21. java.lang.Long
        22. java.lang.Math
        23. java.lang.NegativeArraySizeException
        24. java.lang.NullPointerException
        25. java.lang.NumberFormatException
        26. java.lang.Object
        27. java.lang.OutOfMemoryError
        28. java.lang.Runnable
        29. java.lang.Runtime
        30. java.lang.RuntimeException
        31. java.lang.SecurityException
        32. java.lang.Short
        33. java.lang.String
        34. java.lang.StringBuffer
        35. java.lang.StringIndexOutOfBoundsException
        36. java.lang.System
        37. java.lang.Thread
        38. java.lang.Throwable
        39. java.lang.VirtualMachineError
      3. C. The java.util Package
        1. java.util.Calendar
        2. java.util.Date
        3. java.util.Enumeration
        4. java.util.EmptyStackException
        5. java.util.Hashtable
        6. java.util.NoSuchElementException
        7. java.util.Random
        8. java.util.Stack
        9. java.util.Timer
        10. java.util.TimerTask
        11. java.util.TimeZone
        12. java.util.Vector
      4. D. The javax.microedition.io Package
        1. javax.microedition.io.Connection
        2. javax.microedition.io.ContentConnection
        3. javax.microedition.io.Datagram
        4. javax.microedition.io.DatagramConnection
        5. javax.microedition.io.HttpConnection
        6. javax.microedition.io.InputConnection
        7. javax.microedition.io.OutputConnection
        8. javax.microedition.io.StreamConnection
        9. javax.microedition.io.StreamConnectionNotifier
        10. javax.microedition.io.Connector
        11. javax.microedition.io.ConnectionNotFoundException
      5. E. The javax.microedition.lcdui Package
        1. javax.microedition.lcdui.Choice
        2. javax.microedition.lcdui.CommandListener
        3. javax.microedition.lcdui.ItemStateListener
        4. javax.microedition.lcdui.Alert
        5. javax.microedition.lcdui.AlertType
        6. javax.microedition.lcdui.Canvas
        7. javax.microedition.lcdui.ChoiceGroup
        8. javax.microedition.lcdui.Command
        9. javax.microedition.lcdui.DateField
        10. javax.microedition.lcdui.Display
        11. javax.microedition.lcdui.Displayable
        12. javax.microedition.lcdui.Font
        13. javax.microedition.lcdui.Form
        14. javax.microedition.lcdui.Gauge
        15. javax.microedition.lcdui.Graphics
        16. javax.microedition.lcdui.Image
        17. javax.microedition.lcdui.ImageItem
        18. javax.microedition.lcdui.Item
        19. javax.microedition.lcdui.List
        20. javax.microedition.lcdui.Screen
        21. javax.microedition.lcdui.StringItem
        22. javax.microedition.lcdui.TextBox
        23. javax.microedition.lcdui.TextField
        24. javax.microedition.lcdui.Ticker
      6. F. The javax.microedition.midlet Package
        1. javax.microedition.midlet.MIDlet
        2. javax.microedition.midlet.MIDletStateChangeException
      7. G. The javax.microedition.rms Package
        1. javax.microedition.rms.RecordComparator
        2. javax.microedition.rms.RecordEnumeration
        3. javax.microedition.rms.RecordFilter
        4. javax.microedition.rms.RecordListener
        5. javax.microedition.rms.RecordStore
        6. javax.microedition.rms.RecordStoreException
        7. javax.microedition.rms.InvalidRecordIDException
        8. javax.microedition.rms.RecordStoreFullException
        9. javax.microedition.rms.RecordStoreNotFoundException
        10. javax.microedition.rms.RecordStoreNotOpenException
      8. H. Resources
        1. Additional Resources
          1. J2ME White Papers
          2. J2ME Technologies
          3. J2ME Development Kits
          4. J2ME Developer Resources
          5. XML Parsers for J2ME
    5. Index
    6. Colophon