Pages

Tuesday, August 24, 2010

MIDP-Specific Classes and Interfaces

This portion of the MIDP API is divided among several packages, all of which are prefixed with the javax.microedition name:
• javax.microedition.midlet
• javax.microedition.lcdui
• javax.microedition.io
• javax.microedition.rms

The javax.microedition.midlet Package
The javax.microedition.midlet package is the central package in the MIDlet API, and contains only one class: the MIDlet class. The MIDlet class provides the basic functional overhead required of a MIDP application (MIDlet) that can execute on a mobile device.

The javax.microedition.lcdui Package
The javax.microedition.lcdui package includes classes and interfaces that support GUI components that are specially suited for the small screens found in mobile devices.
Following are the interfaces defined in this package:
Choice—An interface that describes a series of items from which the user can
choose.
CommandListener—An event listener interface for handling high-level commands.
ItemStateListener—An event listener interface for handling item state events.

In addition to these interfaces, also several classes are in the javax.microedition.lcdui package:
Alert—A screen that displays information to the user, and then disappears.
AlertType—Represents different types of alerts used with the Alert class.
Canvas—A low-level drawing surface that allows you to draw graphics on the screen.
ChoiceGroup—Presents a group of selectable items; used in conjunction with the Choice interface.
Command—Represents a high-level command that can be issued from within a MIDlet.
DateField—Presents a date and time so that it can be edited.
Display—Represents a mobile device’s display screen, and also handles the retrieval of user input.
Displayable—An abstract component that is capable of being displayed; other GUI components subclass this class.
Font—Represents a font and its associated font metrics.
Form—A screen that serves as a container for other GUI components.
Gauge—Displays a value as a percentage of a bar graph.
Graphics—Encapsulates two-dimensional graphics operations such as drawing lines, ellipses, text, and images.
Image—Represents a graphical image.
ImageItem—A component that supports the layout and display of an image.
Item—A component that represents an item with a label.
List—A component consisting of a list of choices that can be selected.
Screen—Represents a full screen of high-level GUI information, and serves as the base class for all MIDP GUI components.
StringItem—A component that represents an item consisting of a label and an associated string of text.
TextBox—A type of screen that supports the display and editing of text.
TextField—A component that supports the display and editing of text; unlike TextBox, this component can be placed on a form with other components.
Ticker—A “ticker tape” component that displays text moving horizontally across the display.


The javax.microedition.io Package
CLDC lays the groundwork for networking and I/O with the java.io package and the Generic Connection Framework (GCF). The MIDP API builds on this support with the addition of the HttpConnection interface, which is included in the javax.microedition.io package. The HttpConnection interface solidifies the GCF with support for an HTTP connection, which is useful for accessing Web data from within a MIDlet.

The javax.microedition.rms Package
Because few mobile devices have hard drives or any tangible file system, you probably won’t rely on files to store away persistent MIDlet data. Instead, the MIDP API describes an entirely new approach to store and retrieve persistent MIDlet data: the Record Management System (RMS). The MIDP RMS provides a simple record-based database API for persistently storing data. The classes and interfaces that comprise the RMS are all located in the javax.microedition.rms package.
Following are the RMS interfaces found in this package:
RecordComparator—An interface used to compare two records.
RecordEnumeration—An interface used to iterate through records.
RecordFilter—An interface used to filter records according to certain criteria.
RecordListener—An event listener interface used to handle record change events.
In addition to these interfaces, a few classes fit into the RMS architecture. Most importantly, the RecordStore class represents a record store, which is essentially a simplified database for MIDlet data storage.

The following classes are included in the javax.microedition.rms package:
InvalidRecordIDException—Thrown whenever an operation fails because the record ID is invalid
RecordStore—Represents a record store
RecordStoreException—Thrown whenever an operation fails because of a general exception
RecordStoreFullException—Thrown whenever an operation fails because the record store is full
RecordStoreNotFoundException—Thrown whenever an operation fails because the record store cannot be found
RecordStoreNotOpenException—Thrown whenever an operation is attempted on a closed record store


Sumber: Sams Teach Yourself: Wireless Java With J2ME in 21 Days

No comments:

Post a Comment

 

Blogger news

About Me

My photo
Palembang, Sumatera Selatan, Indonesia
Seorang yang ingin terus belajar.