Professional Documents
Culture Documents
Java 2 Platform, Micro Edition (J2ME
Java 2 Platform, Micro Edition (J2ME
Java 2 Platform, Micro Edition (J2ME
Rahul Pol.
J2ME
Java Editions
Different devices have different requirements and
different expectations of Java. One platform (solution) cannot address all the market segments (web server, video games etc.) Users/developers want flexibility. They want to choose what they want to use and what they do not.
J2ME
Java Editions
The Java 2 Platform is split into three editions. Each edition provides a complete environment for
running Java-based applications, including the Java virtual machine (VM) and runtime classes. The three editions target different kinds of applications running on different kinds of devices.
J2ME
Java Editions
Java2 Standard Edition (J2SE)
Java 2 Platform
J2ME
Java Editions
Each edition defines different sets of class libraries.
There are thousands of core J2SE runtime classes, taking up to 10-20 megabytes
J2EE J2SE
J2ME
J2ME
J2ME
Configurations
A configuration is a complete Java runtime
minimum requirements.
J2ME
Configurations
Configuration
CLDC
CDC
J2ME
CDC
2 MB or more memory
for Java platform 32-bit processor 160 - 512 KB of total memory High bandwidth 16-bit or 32-bit processor network connection, Low power consumption and most often using often operating with battery power TCP/IP Connectivity with limited bandwidth
J2ME
J2ME
10
Profiles
Adds domain-specific classes to a configuration:
To fill in missing functionality To support specific uses of a device
Most profiles define user interface classes for building interactive applications. To use a profile, the device must meet the minimum requirements of the underlying configuration and of the profile.
J2ME
11
Profiles
MIDP PDAP
Profile
FP
PBP
PP
Foundation Profile
Personal Profile
J2ME
12
J2ME
13
Optional Packages
Set of APIs in support of additional, common
behaviors. Have specific dependencies on a particular configuration and/or one or more profiles. Examples of optional packages :
RMI Optional Package Bluetooth Optional Package
J2ME
14
that use a static main method as their entry point, nor calling the System.exit method in order to terminate. Instead, we use a MIDlet, which is a MID Profile application.
J2ME
15
J2ME
16
application. The MIDlet class defines abstract methods that the main class implements (for example: startApp(), destroyApp(), notifyDestroyed()).
J2ME
17
MIDlet Suite
One or more MIDlets are packaged together into a
J2ME
18
J2ME
19
J2ME
20
Form
Command CommandListener ItemCommandListener Item
J2ME
21
Form class
A Form is a Screen that contains an arbitrary mixture of items: images, read-only text fields, editable text fields, editable date fields, gauges, choice groups, and custom items.
In general, any subclass of the Item class may be contained within a form. The implementation handles layout, traversal, and scrolling.
J2ME
22
Layout
public void
setItemStateListener(ItemStateListener iListener)
J2ME
23
Command
CommandListener
ItemCommadListener
Item
J2ME
24
Command class
The Command class represents the semantic meaning of an action. Command objects are presented in the user interface. The action itself is implemented in a CommandListener object. The CommandListener is associated with a Displayable or an Item. Once the Command is called the CommandListener is invoked, and the action is performed.
J2ME 25
Command class
Command label
J2ME
26
J2ME
27
the application is notified by having the commandAction() method called on the ItemCommandListener that had been set on the Item. public void commandAction(Command c, Item item)
J2ME
28
Item
J2ME
29
Item class
A superclass for components that can be added to a
Form. All Item objects have a label field Choose the Items layout, size, and appearance Attach Commands
J2ME
30
setDefaultCommand(Command cmd) public void setItemCommandListener(ItemCommandListe ner listener) public void notifyStateChanged() public int getPreferredWidth()
J2ME
31
Getting Started
1st step: Download suns J2ME Wireless
Toolkit from:
http://java.sun.com/products/j2mewtoolkit/download. html
J2ME
32
J2ME
33
Web services
J2ME
34
The END!
You can download all the demos JARs from:
www.cs.huji.ac.il/~kerengaz/j2me/
Have Fun!!!
J2ME
35