When Java ME technology started in 2000 (back then it was called J2ME) there weren't many choices available for developers for graphical API at that time. In fact, the only API that was available was the standard LCD user interface packages of
A majority of these APIs have been finalized and are available in mobile devices today, but some of them are still under specification in JCP. So now that all the preliminaries are out of the way, let's get started! ContentsWith billions of mobile devices running Java ME technology, by far the most common devices are phone handsets running the Mobile Information Device Profile (MIDP). Figure 1, below shows the minimum screen requirements for MIDP 1.0, 2.0, and 3.0 devices and provides relative sizes for comparison purposes.
The graphical capabilities of the MIDP 1.0 and 2.0 specifications were designed to support the multi-color displays of today's mobile phones, but also (at a minimum) support two-way pagers or devices with monochrome displays. MIDP 3.0 devices will be geared towards a richer mobile experience, and requires that mobile devices support at least 64k colors. All MIDP implementations support high-level and low-level user interface components. If you're new to Java ME, then that probably didn't mean a lot to you, so let me clarify things. All user interface classes for MIDP devices can be found in the
One of the major advantages of the high-level API is the fact that high-level GUI components are rendered by the mobile device, thus allowing the device to present the components in an appropriate manner (which could either be native look-and-feel on the handset or something else). Figures 2 and 3 are both running the same application, and as you can clearly see each MIDP implementation rendered the insurance claim application interface differently (you should notice that the image in Figure 3 has a scrollbar, while the one in Figure 2 does not). All MIDP implementations have and support the usage of the following high-level components:
In contrast, the low-level APIs for MIDP applications allow the developer to have greater control of the user interface, and therefore the developer has the responsibility for drawing and rendering the display. The major low-level API classes are
The MIDP 2.0 specification added a bridge between the high-level and low-level APIs: the
MIDP 3.0 also supports the Midlet concurrency (where more than one Midlet can run at the same time, which is a handy feature) and Inter-Midlet Communication (where two concurrently Midlets can communicate with each other). Although all MIDP versions support the displaying of rasterized images (in PNG format only) MIDP 3.0 finally adds support for GIF images. The Connected Device Configuration (CDC) was created to address the class of devices that fall in to the following category:
So what's a typical CDC device? Well, that's kinda hard to say. The CDC is available for certain high-end mobile phones with the Symbian OS, but it's also available for PDAs and other mobile devices that run the Windows Mobile OS. It's available in certain network access points, but it's also embedded in every Blu-ray Disc player -- and that includes the Sony Playstation 3 game console! So despite the fact that there isn't a "typical" CDC device, the Personal Basis and Personal Profiles were created to provide graphical interfaces for a group of devices that encompasses a broad range of mobile and embedded devices. The Personal Basis Profile (regardless if you're using version 1.0 or 1.1) incorporates a very small subset of the Java SE Abstract Windowing Toolkit (AWT) libraries. The Personal Basis Profile is very lightweight, so classes for rendering simple UI components like buttons, menus, list, textboxes, scrollbars, etc. have been removed. The Personal Profile (regardless if you're using version 1.0 or 1.1) is almost a complete implementation of the Java SE AWT, and even provides support for applets. So then what's the difference between versions 1.0 and 1.1 of the Personal Basis and Personal Profiles? Version 1.0 of both profiles is based upon the Java SE 1.3 AWT API, while version 1.1 is based upon the Java SE 1.4.2 AWT. Figure 5 shows a simple application based upon the Personal Profile.
Scalable Vector Graphics (SVG) is an XML-based vector graphics framework. SVG images are vastly different from rasterized (i.e bitmapped) graphics formats like GIF, JPEG, or PNG due to the fact that SVG images are calculated (like a mathematical formula) and displayed rather than pixels placed on a screen. SVG images are scalable, so they are really handy if you need to zoom in for more detail, or zoom out to show more data. SVG images are stored as XML documents, and that brings along several advantages, namely, you can modify them programmatically simply by changing fields within the XML tags. Being XML documents, it also makes it pretty easy to search for text embedded within the image, which is currently pretty difficult for rasterized images. SVG supports animation and transformations, and you can imagine it being a W3C standardized version of Adobe Flash, but based upon XML rather than Adobe's proprietary format. Figure 6 depicts a simple SVG weather image that I created using the Beatware Mobile Designer 2.0.
The XML needed to create the image shown in Figure 6 is shown below:
Now that some of the mystery of SVG has been dispelled, you should know that the SVG specification is divided into profiles. The SVG profiles serve the same purpose as Java ME specification's profiles: to provide a richer experience for more capable devices/platforms, but also provide basic functionality for limited devices/platforms. The current SVG profiles are:
Both SVG Basic and SVG Tiny are classified as SVG Mobile Profiles. The Scalable 2D Vector Graphics API version 1.0 (JSR-226) defined the
Now version 2.0 of Scalable 2D Vector Graphics API (JSR-287) is intended to fully support SVG Tiny 1.2, and defines 5 packages and over 20 classes. The packages in the Scalable 2D Vector Graphics 2.0 API are:
Version 2.0 of the specification is designed to provide a richer user experience, and incorporate video, as shown in Figure 7.
The Mobile 3D Graphics API (JSR-184) version 1.0 was the first standardized Java ME API for 3D graphics development. This API defined the
OpenGL and its mobile subset, OpenGL ES, are both extensible, standardized, and cross-platform 3D APIs. The Java Binding for OpenGL ES API (JSR-239) was designed to be a subset of its Java SE counterpart (JSR-231). OpenGL ES specification is also divided into profiles (like the Java ME and SVG specifications). Two profiles are:
The Java Binding for OpenGL ES API implements the OpenGL ES Common profile version 1.0 and 1.1, and defines two new packages:
Unlike the Mobile 3D Graphics 1.0 specification, the Java Binding for OpenGL ES API supports floating point operations, which makes this API exclusively for CLDC 1.1 devices. Additionally, this API does not support the m3g file format defined in the Mobile 3D Graphics 1.0 specification. Figure 9 shows a sample application using the Java Binding for OpenGL ES API.
Now, the final 3D API under the auspices of the JCP is the Mobile 3D Graphics 2.0 API (JSR-297), i.e. M3G 2.0, and below is a list of the goals of the M3G 2.0 JSR:
The M3G 2.0 specification will be designed to allow for implementations of the specification on mobile devices that includes OpenGL ES graphics hardware, as well as on devices without any graphics hardware, i.e. just a pure OpenGL ES 1.1 software implementation. The M3G 2.0 API should add additional functionality and bridge the gap between the two currently defined 3D graphics libraries for the Java ME platform. The Advance Graphics and User Interface (JSR-209) API is the long-awaited solution for developers who are working with CDC-based implementations, and are trying to port Java Swing applications or frameworks to the Java ME platform. The AGUI API is dependent upon the CDC 1.1, Foundation Profile 1.1, and Personal Basis Profile 1.1. The AGUI API provides implementations for the following packages:
Now, you should note that the AGUI optional package doesn't provide you with a complete implementation of the Swing API provided in Java SE 1.4.2. For instance, you can only have one JFrame at a time, so be sure to check with the release notes for AGUI to understand all of it's limitations. Figure 10 depicts the AGUI API running the quintessential SwingSet application. You should notice the tabbed panes, internal frames, scrollbars, menus, menu items, and icons.
Hopefully this article provided you with a simple way to get up to speed on all the graphical capabilities of the Java ME platform. Figure 11 provides a handy reference for all the Java ME graphical APIs.
Please stay tuned for another article providing hands-on examples with some of the more popular API for Java ME CDC and CLDC! | ||||||||||||||||||||||||||||
|
| ||||||||||||