Monday, March 16, 2009

Comparison between AWT and LWUIT

LWUIT is inspired by Swing. At the API level it is almost identical to AWT. It allows to reuse the AWT code generated from Netbeans at LWUIT. I created a simple AWT form with just TextField and Label. The code is almost same that I can use the initComponent with minor adjustment. One issue is add function. At LWUIT there is not add function instead it has addComponent. So what I did is that a form is extended and add function is created with does nothing but call the addComponent.

public void add(Component component){
addComponent(component);
}

Now the initComponent function can be used directly in a LWUIT application.