C H A P T E R  9

LWUIT Implementation

The LWUIT implementation is the foundation of LWUIT and its portability. It is a single huge class representing a hardware abstraction layer (HAL) that contains all the platform-specific code within LWUIT.


The LWUIT implementation is a mechanism for the use of LWUIT developers and "deep hacking." It won't maintain compatibility between versions since it is not generally exposed for developers.

9.1 LWUIT Class

The underlying implementation is often replaced implicitly by using things like the CDC port of LWUIT, which is mostly an implementation class that delegates its calls to the appropriate CDC APIs rather than MIDP's APIs.

Developers should be aware that the LWUIT implementation can be replaced. That is, a developer relying on MIDP API's such as Canvas might run into errors when running on different platforms.

LWUIT ships with an SVGImplementation that can be installed by invoking:


Notice that this method must be invoked before Display.init() is invoked! The implementation cannot be replaced at runtime.

The SVGImplementation allows LWUIT to treat SVG image files as if they were standard LWUIT images.

LWUIT also features a VKBImplementation that allows binding a virtual keyboard for touch devices. There are several 3rd-party and LWUIT team implementations mostly designed for porting LWUIT to various platforms.