User interfaces in Java ME

All user interface (UI) manipulation is handled through one of the following:

  • LCDUI

  • eSWT (only on Symbian)

  • Separate graphics APIs, including:

    • Scalable 2D Vector Graphics API (M2G)

    • Mobile 3D Graphics API (M3G)

    • Nokia UI API

On Symbian platforms, there are two alternatives for choosing the base UI for the application: eSWT and MIDP LCDUI. For maximum portability, using LCDUI is preferable since eSWT is only available from S60 3rd Edition FP 2 onwards. When MIDP LCDUI is used for UI creation, the central abstraction of the MIDP’s UI is a Displayable object, which encapsulates device-specific graphics rendering with user input. Only one Displayable may be visible at a time, and the user can see and interact with only contents of that Displayable. The figure below shows how the general hierarchy of display elements is arranged.

Figure: Packages with UI related functions

Developer's guides

Below is a list of developer's guides that are related to working with UI. Developers with no experience in the use of the LCDUI or eSWT UI components should read those guides first.

Note: Nokia also provides a custom UI extension to MIDP 1.0, Nokia UI API. Some classes and methods of Nokia UI API have been deprecated as they are available in standard MIDP 2.1. The deprecated parts are clearly listed in the API specification of Nokia UI API. It is recommended to use MIDP 2.1 counterparts instead, when possible.

Comparison of UI APIs

MIDlet UI's can be developed with two distinct UI architecture APIs:

The MIDP LCDUI is designed to be highly implementable on a variety of mobile devices. Maintaining LCDUI compatibility with low-end devices has somewhat prevented it from utilizing the capabilities of newer devices. As a response to the need for a more feature rich UI toolkit with better access to Symbian native UI solutions from Java, eSWT has been released. eSWT can be considered as an alternative UI toolkit for the well-established LCDUI.

Both APIs provide sets of features for user interface implementation in MIDP applications and utilize a similar UI architecture. Both eSWT and LCDUI support Mobile Media API (JSR-135), but LCDUI features can be further extended with additional graphics APIs described in this library, such as Scalable 2D Vector Graphics API (JSR-226) or Mobile 3D Graphics API (JSR-184).

  • When to use LCDUI

    In general, it is recommended that you use LCDUI when its features are adequate enough for the task in hand. LCDUI offers better portability and ease of development than eSWT because of its simplicity.

    Also, you must use LCDUI when designing applications for:

    • Series 40 devices. The Series 40 platform does not support eSWT, so any Java application that needs to be run on a Series 40 device must be implemented with LCDUI.

    • Symbian devices running S60 3rd Edition FP1 or earlier. The Symbian platform supports eSWT from S60 3rd Edition FP2 onwards.

  • When to use eSWT

    Use eSWT when your MIDlet requires finer control over the UI or a greater variety of UI components (called widgets in eSWT) than what the LCDUI API can offer. eSWT is also a good UI API to use when some parts of the user interface code need to be shared with desktop computers as eSWT is a subset of the cross-platform SWT toolkit.

    Note: eSWT MIDlets can only be distributed to Symbian devices running S60 3rd Edition FP2 or newer.

    Note: eSWT is currently also available for Windows Mobile Devices via Eclipse eRCP project. eSWT is a new API, and there are other platform implementations currently in the works. For information on other implementations, see eRCP project web site.

More information

For more general information about user interfaces in Java ME, see: