Wednesday, July 15, 2009

LWUIT 1.2 Released Further Details

Chen announced yesterday the LWUIT 1.2 release on the mailing list/forum, I'll try to go into further details on the announcements highlights regarding whats new. This is mostly targeted at people who don't follow SVN closely:

  • New Styling concept - first announced here, this new feature revolutionizes the way LWUIT treats styles. Rather than have a single style object per component we can have 2 or more styles and the component can replace them in runtime based on state (this is very similar to CSS e.g. hover selector).
    All components now have a selected/unselected style to represent focus, this essentially deprecates fg/bgSelection attributes instead allowing you to customize every style attribute for selection state (e.g. bgImage, transparency, border etc.).
  • New LWUIT Designer (formerly Resource Editor) - I've spent allot of time working on this particular feature, one of the coolest things is that if you have Java 6 installed you will see an orange button here & you can just click it to launch the LWUIT Designer using Java Web Start.
    The LWUIT designer supports the new styles concept allowing your designer far greater power in determining the theme for LWUIT applications. We also updated the resource file format (more on that later) which allows us to export the resource file into an Ant task structure (frequently requested feature that was previously impossible).
    We also offer lots of great usability features such as Copy & Paste for theme entries, simpler image border editing, easier to use preview etc.
  • Support for setUIID - this was technically impossible in previous releases of LWUIT but newer changes allowed Chen to implement this revolutionary feature. You can now easily make TextArea or button have a label style rather than start manipulating borders, this works better with the theming support as well.
  • Background Painter Features - Style now includes more elaborate image scaling, tiling, centering as well as gradient backgrounds (Radial, Linear etc.). These are supported by the LWUIT designer and by the standard LWUIT background painter, allowing a designer more power without code changes.
    This also allows reducing resource sizes since no images are required for some very elaborate themes! E.g. the theme created here is 7kb with the bitmap font and 622 BYTES without it!
  • Scrolling in LWUIT with components greater than screen size has always been a problem, this is now fixed in with a rather complex recursive algorithm. This is still not the non-focus based scrolling we would expect in the future but it does simplify some common use cases.
  • SVGImage is now deprecated, instead we can integrate SVG's directly into LWUIT via the SVGImplementionFactory by calling SVGImplementionFactory.init() before the first Display.init() call.
    This would allow Image.createSVG to "just work" on devices with JSR 226 support. Since the SVG related code is entirely within the SVGImplementation it wouldn't appear in versions of LWUIT that don't include the SVGImplementionFactory.
    We intend to offer full SVG support in the LWUIT Designer soon, this will also allow fallback images so devices without SVG support will see an "auto generated" PNG file.
  • Fonts have been rewritten to include more information in the resource file and allow us to load a font by name. This will allow truetype fonts when supported by the native platform e.g. in MIDP 3 or JSR 287.
  • The Ant task used to create theme now uses the same code base as the LWUIT designer and follows a somewhat modified syntax. I'll try to blog about this more in the future, the advantage is that we would be able to track changes more easily to both.
    This allowed us to find quite a few bugs in both tools so its a great feature at that.
  • New Calendar component is redesigned to use component/container hierarchy rather than custom painting. This solved allow of issues we had with the calendar such as proper touch phone support.
  • The LWUIT distribution includes a PDF with a specification of the resource file format used by the LWUIT Designer/ant task.
    This is an important step in formalizing the file for future versions and for corporate uses that might need such information. We are considering the option of providing a desktop based resource file generation API, I will hopefully post about this in the future soliciting feedback.

Besides the above LWUIT looks & feels better and faster than ever with every version, we shrunk code size in some use cases and try to provide more power to developers. The full list of changes is too big to mention e.g. one of the last things to make it into the release was the often requested "minimize" feature...


  1. This comment has been removed by the author.

  2. How to use minimize feature ? currently doing with making display null. but its not working when commands comes to menu..

  3. There are now methods related to minimize/restore in Display.

  4. @Elliot this is a mistake in the current release build script that we missed. We will incorporate this PDF into 1.3, since licensing is involved we can't just publish things without authorization.
    We hope to get 1.3 out of the door before the years end.

  5. hai shai,
    im using LWUIT along with J2ME and i used themeing using LWUIT editor but the theme is being applied only for title and only few elements at the top, it is not applied for the commands at the bottom and the elements below..... if there is any solution please reply to this mail plzzz reply soon