Skip to main content

Coming soon: Swing for mobile Java, but better

Posted by terrencebarr on April 26, 2008 at 12:04 PM PDT

Picture 2.png Picture 4.png Picture 5.png Picture 7.png

Updates

  • 8/18: Updated FAQ question on Java FX Mobile
  • 5/4: Added note on Sprint WTK 3.3 support for LWUIT
  • 5/4: Added notes on LWUIT support on non-MIDP platforms

Welcome LWUIT (Lightweight UI Toolkit)!

For years, Java ME developers have faced difficult choices when it comes to application UIs. Because of the multitude of platform and device features and differences there was really no common UI story - there is MIDP for CLDC and AWT for CDC, APIs like JSR 226 (SVG) and JSR 209 (AGUI), and finally a number of 3rd party toolkits such as J2ME Polish.

Now, it is definitely possible to develop very slick user interfaces based on some of this technology - but every approach has its limitations and downsides. In particular, what ends up happening is that developers and/or toolkit suppliers end up reinventing the wheel by creating a lot of common functionality over and over again - things like component models, rendering and font engines, layout managers, animations and transition effects, etc. APIs such as JSR 226 (SVG) and 209 (AGUI) are necessary in providing this functionality going forward but, as standards go, they are slow to spread into the device base and don't help developers address a large part of today's market.

Over the last two years Sun has worked on some internal projects that required rich applications UIs running on todays mid-range mass-market devices - platforms where forthcoming standards are not yet available. After investigating the options Sun decided to build a rich UI toolkit internally for that purpose. Over the last couple of months we've been showing the results to select partners and developers and the response has been extremely positive. Because we believe this toolkit is of significant value to the developer community at large Sun has decided to make it available as open source in the Java Mobile & Embedded Community to encourage use, feedback, and involvement by the community.

What is it?

LWUIT (the current project name - it may still change) is a library that developers simply bundle with their application. It is inspired by Swing and provides a rich, compelling, and consistent UI across a wide range of todays mass-market devices. It sits on top of MIDP 2.0 and implements a peer-less graphics and UI model in a compact package with small footprint and moderate performance requirements. Because it is simply a library that developers bundle with their application the deployment is familiar and easy and improvements to the library can be easily made available to the application by simply upgrading the library.

Update: LWUIT will also be available on other platforms such as CDC/FP/PBP. This means applications written to LWUIT will run on multiple platforms easily - meaning dramatically increased portability for developers.

LWUIT Key features:

  • Swing-like MVC
  • Layouts
  • Pluggable look-and-feel and themes
  • Fonts
  • Touch screen support
  • Animations and transitions
  • Rich widgets
  • 3D integration
  • Painters
  • External tools support
  • I18N/L10N support
  • Moderate performance and footprint requirements
  • Multi-platform support
  • SVG (scalable vector graphics) integration (forthcoming)

What does it look like?

A look at the screen shots (from left to right):

  • The LWUIT demo application home screen running on phoneME Advanced on Windows Mobile
  • An example of the theme support of LWUIT - the theme has been dynamically changed. What you cannot see is that the fish in the lower right is actually animated in the background while the application progresses.
  • The same, unmodified LWUIT demo application home screen running on WTK 2.5.1
  • An example of a consumer-services application built with LWUIT

What license will be used?

A key goal is broad adoption of LWUIT. We want to make it easy for developers to use and improve LWUIT and we are looking at liberal and well-known open source license choices. Details to be announced.

When and where will it be available?

LWUIT will be placed into the ME Application Developers Project in the Java Mobile & Embedded Community. We aim to release it very shortly - first as an early access binary and shortly thereafter as full source. More details to be announced.

Update: LWUIT is a key part of Sprint's new WTK 3.3 toolchain - to be released very shortly. This means developers using the Sprint tools will have LWUIT as a preinstalled option in the toolchain, including documentation and support by Sprint. For more information see the Sprint Application Developer program news.

Where can I learn more about LWUIT?

LWUIT will be announced at JavaOne next week in Jeet Kaul's Mobility General session on Tuesday at 3:20 pm. Also, a technical session was added last minute to the schedule:

Finally, we will be demoing LWUIT on devices in several Sun booths such as the Java Mobile & Embedded Community booth in the Mobility Village.

FAQ:

  • Why another Java ME UI toolkit?

Key design goals for LWUIT were to enable rich and compelling applications on todays targets mass-market phones combined with the familiarity of existing APIs (AGUI and Swing), ease of deployment, and a liberal open source license. We felt that LWUIT was unique and compelling enough to make it available to the general developer community. We are looking forward to your feedback and involvement.

  • Update: Is LWUIT limited to MIDP platforms?

No. LWUIT is a library that can be ported to any Java platform that supports basic 2D rendering. LWUIT will initially be released for MIDP 2.0 but a CDC/FP/PBP version will follow soon. This means applications based on LWUIT will easily migrate from one platform to another as long as LWUIT is available for the target platform.

  • Does LWUIT supersede/replace/make obsolete MIDP?

No. LWUIT offers a rich UI alternative that sits on top of the MIDP APIs. Both complement each other and LWUIT remains strictly optional for use by the developer.

  • Does LWUIT supersede/replace/make obsolete JSR 226 (SVG) or JSR 209 (AGUI)?

No. In fact, LWUIT will add SVG integration in a future release. And because LWUIT is inspired by the AGUI/Swing APIs developers should find it easy to move between LWUIT and AGUI/Swing APIs now and for future platforms. As mentioned above LWUIT remains strictly optional for use by the developer depending on the particular need and situation.

  • Does LWUIT supersede/replace/make obsolete other UI toolkits such as J2ME Polish?

No. LWUIT was developed for a particular design center and we believe it offers very attractive functionality in that space. LWUIT is strictly optional and does not supersede or make obsolete any other UI toolkits currently available. Due to the open source nature of LWUIT we hope cross-pollination will occur for the benefit of the entire industry.

  • How does LWUIT relate to Sun's Java FX Mobile?

As mentioned above LWUIT focuses on UI and graphics and runs on the vast majority of MIDP devices (including MSA platforms) and thus is a compelling option to address today's market. Java FX Mobile, when available, will target MSA-compliant phones representing a smaller but growing and more recent segment of the market. Java FX Mobile not only offers advanced UI and graphics capabilities but also rich media, scripting, and more. Since MSA platforms support both the developer has the option to choose based on their particular needs. For more information please see the FAQ on the topic.

More information and details will be released at JavaOne. Be sure to attend the TS-4921 session on LWUIT and visit our booths for demos. And watch the Java Mobile & Embedded Community front page for late-breaking news.

Cheers,

-- Terrence

Comments

The library will be made available this week as part of the announcement at JavaOne. I'll let you know where to find it when it's available.

-- Terrence

how can I get LWUIT this lib te develop j2me program

sfitzjava,

Not sure I understand the question. LWUIT is not specific to the underlying OS - it just requires MIDP. Maybe you are saying LWUIT exposes bugs in the Linux WTK MIDP implementation?

-- Terrence

vprise,

Thanks for the comment. You're absolutely right - I've updated the blog.

-- Terrence

PS: The library has been released. See https://lwuit.dev.java.net/

-- Terrence

Will it be available on the Linux WTK too? I saw a pre-release but it was on windows, and when I tried it on Linux had some issues.

Great news!!

Great post Terrence. Minor correction to the AGUI point, you won't need to port applications to AGUI they would work seamlessly on top of AGUI since LWUIT is portable to CDC PBP/AGUI. It takes advantage of Java2D features such as anti-aliasing seamlessly.

mikeazzi, Good point, thanks for asking. Will add. -- Terrence

Hi Terrence, Interesting project. If I may, I would like to add one more question to your LWUIT FAQ: Where does this fit within Sun's JavaFX Mobile strategy? With Sun shifting focus toward JavaFX, I am sure a lot of people would be wondering the same.