Initializing LWUIT and creating a form

Add the following code to the <yourMidlet.java> file to initialize LWUIT and create the first screen or form:

import javax.microedition.midlet.MIDlet;
import com.sun.lwuit.Display;
import com.sun.lwuit.Form;

public class Midlet
    extends MIDlet {

    public void startApp() {
	     Display.init(this);
        Form form = new Form("Hello World");
        form.show();
    }

    public void pauseApp() {
    }
    
    public void destroyApp(boolean unconditional) {
    }
}

Display.init is a static method that creates a device-specific implementation class instance behind the scenes and sets some parameters based on, for example, the number of softkeys and whether or not the device has a touch screen. Form's in LWUIT are analogous to LCDUI's forms and represent different screens in the application.