Tuesday, March 29, 2011
A New Way To LWUIT
LWUIT had a MIDP bias. It started as a MIDP project so it is perfectly understandable, however moving forward to support RIM and other platforms (e.g. Thorsten's great work) we wanted to completely disconnect LWUIT from its platform specific roots and offer some great new features in the process.
It started off when we generated projects for the GUI builder, but we decided to take this further into the LWUIT Demo and make that approach into our project structure recommendation. You can checkout the source code for the new LWUIT Demo from SVN to see the actual structure.
Basically what we are doing is placing all the LWUIT portable code into a MIDP shared library, this is effectively the common code for the project. Here we also place the common resources used within all the different ports.
Underneath this project (mostly for convenience not due to necessity) we place subprojects that depend on that parent project and are platform specific. That way we don't need a pre-processor or any similar tool to gain both portability and the ability to utilize platform specific features when we want to do so.
The really cool feature hidden beneath this is the ability to utilize the JavaSE port to run the application. Besides running practically instantly (no simulator!), the biggest hit is the ability to use Java SE level development tools!
Edit & continue, profilers, threadalizers, memory monitors etc. Its a whole different scale of debugging for business logic (assuming the issue reproduces on the SE port). Besides debugging this feature allows you to embed your application as an Applet right into a web page to provide users with a live preview of your application! How cool is that!
To your right you can (hopefully) see a running Applet containing the current version of the LWUIT demo. You can use escape as a back button, F1 as the menu button and the arrow keys/mouse to navigate within this Applet.