Click here to Skip to main content
15,886,095 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,i am doing a project with LWUIT 1.4.0(ResourceEditor),netbeans 6.9 i create a form welcome on which i have two radio buttons Verification and Enrollment when user select Verification and press OK button then a form(Login) should display and when it select Enrollment then authentication form display.I create gui with resource editor it generates four project by default in netbeans,1.Demo,2.Demo_Desktop,3.Demo_MIDP,4.Demo_RIM(for blackberry),currently i am running desktop projetc.Resource editor generates two file statemachine and statemachinebase class.I have to write my code in statemachine class.I posted my code
MSIL
/**
 * Your application code goes here
 */

package userclasses;

import generated.StateMachineBase;
import com.sun.lwuit.*;
import com.sun.lwuit.events.ActionEvent;
import com.sun.lwuit.events.ActionListener;
import com.sun.lwuit.RadioButton;
import com.sun.lwuit.util.Resources;
import com.sun.lwuit.ButtonGroup;

/**
 *
 * @author Your name here
 */
public class StateMachine extends StateMachineBase implements ActionListener {
     Button OK;
    Resources resources;
    RadioButton Verifi=new RadioButton("Verification");
    RadioButton Enroll=new RadioButton("Enrollment");
    Form fo,f;ButtonGroup bg=new ButtonGroup();
    StateMachineBase cl=new StateMachineBase()
    {};
    public StateMachine(String resFile) {
        super(resFile);
    }

    /**
     * this method should be used to initialize variables instead of
     * the constructor/class scope to avoid race conditions
     */
    StateMachine() {

try{
    resources = Resources.open("/NEW AADHAR.res");
}
catch(java.io.IOException err)
{ err.printStackTrace(); }
cl.setHomeForm("Welcome");
 //fo = (Form)cl.startApp(resources,null,true);
fo=Display.getInstance().getCurrent();
f=cl.findWelcome(fo);
Verifi=cl.findVerification(f);
Enroll=cl.findEnrollment(f);
bg.add(Enroll);
bg.add(Verifi);
OK=cl.findOK(f);
//f.addCommandListener(this);
//Verifi.addActionListener(listener);Enroll.addActionListener(listener);
}


    protected void initVars() {
    }

    /**
     * @param c
     * @param event
     */
    public void actionPerformed(ActionEvent ae) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    protected boolean onWelcomeEXIT() {
        boolean val = super.onWelcomeEXIT();
        return val;
    }
 protected void onWelcome_OKAction(Component c, ActionEvent event) {
    }

    ActionListener listener=new ActionListener()
{
         public void actionPerformed(ActionEvent ae) {

        System.out.print("HIIIIIIIIIIII");
        super.onWelcome_VerificationAction(c, event);
       super.onWelcome_EnrollmentAction(c, event);
       // Verifi = (RadioButton) c;  // initialize here
     Verifi.addActionListener(listener);
      Object source =ae.getCommand();
        if (Verifi.hasFocus()) {
         if(source==OK.getText())
     {

           showForm("Login",null);}
        } else {
           Dialog.show("INFORMATION", "Please select option", "OK", "Cancel");
        }
            throw new UnsupportedOperationException("Not supported yet.");

        }
    };
}

When i add radiobuttons and buttons then these are automatically generated in statemachinebase class i just used them in statemachine class.
findVerification()
findEnrollment()
onWelcome_OKAction()
onWelcomeEXIT()
Thanks
Posted
Comments
Firo Atrum Ventus 27-Jul-11 1:44am    
And the question is?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900