Search code examples
java-melwuit

LWUIT assistance


import com.sun.lwuit.Button;
import com.sun.lwuit.Command;
import com.sun.lwuit.Display;
import com.sun.lwuit.Label;
import com.sun.lwuit.events.ActionEvent;
import com.sun.lwuit.events.ActionListener;
import com.sun.lwuit.layouts.BorderLayout;
import com.sun.lwuit.plaf.UIManager;
import com.sun.lwuit.util.Resources;
import java.io.IOException;


public class Ruwwa extends javax.microedition.midlet.MIDlet
       implements ActionListener{

Form f;
Button mybutton1;
Button mybutton2;
Command exit;
Command ok;


public void startApp() {

       Display.init(this);

       f = new Form();

       try {

       Resources r = Resources.open("/mairuwa.res");
       UIManager.getInstance().setThemeProps(r.getTheme("Mairuwa Theme"));

       } catch (IOException ioe) {
         ioe.printStackTrace();
       }

       mybutton1=new Button("Report A Problem");
       mybutton2=new Button("Request Info");

       f.setLayout(new BorderLayout());
       f.addComponent(BorderLayout.CENTER, new Label("The Mairuwa Portal"));

       ok = new Command("OK");
       exit = new Command("Exit");

       f.addCommand(ok);
       f.addCommand(exit);
       f.addCommandListener(this);

       f.show();

       }

public void pauseApp() {}

public void destroyApp(boolean unconditional) {}

public void actionPerformed(ActionEvent ae) {
   notifyDestroyed();
}

}

I would like to add another label under the "The Mairuwa Portal" and also place two buttons ("Report A Problem","Request Information") beneath this as well. An illustration of what I am describing is

label: The Mairuwa Portal
then another label beneath it: I want to:

Then two buttons beneath this Button:Report Problem Button: Request Information
I have been able to add OK and EXIT button to the project,but this above buttons I talked about should as I described.
These buttons will carry functionality. I hope this can be done in LWUIT.


Solution

  • You need to include all JSR's when compiling a LWUIT application in the IDE. LWUIT doesn't require them all to run but requires 184, 226, MMAPI & file connector to compile. This is causing your verification error.

    I would recommend developing with the Sun/Oracle simulators and using the more device like emulators for QA.

    The exception you got means your application was built incorrectly, see that Ruwwa is in the jar file that was produced by your build. If not fix your build.