Results 1 to 2 of 2
  1. #1
    gaurav_17may is offline Member
    Join Date
    Jul 2011
    Posts
    1
    Rep Power
    0

    Default lwuit radio button

    hi all,i have my welcome form on which there r two radio buttons(Verification,enrollment) and OK button when user checks Verification and press OK then new form(login) should open.and when enrollment is check then another form(authentication) should display.I have my code below in statemachine class.i am using lwuit1.4.0 and netbeans6.9

    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;




    /**
    *
    * @author Your name here
    */
    public class StateMachine extends StateMachineBase implements ActionListener {


    Resources resources;
    RadioButton Verification;//=new RadioButton("Verification") ;
    RadioButton Enrollment;//=new RadioButton("Enrollment");
    StateMachineBase cl=new StateMachineBase()
    {};

    ButtonGroup bg=new ButtonGroup();

    Form fo,f;

    public StateMachine(String resFile) {
    super(resFile);
    // do not modify, write code in initVars and initialize class members there,
    // the constructor might be invoked too late due to race conditions that might occur
    }


    /**
    * 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);
    Verification=cl.findRadioButton1(f);
    Enrollment=cl.findRadioButton(f);
    Verification.addActionListener(this);
    Enrollment.addActionListener(this);

    bg.add(Enrollment);
    bg.add(Verification);bg.setSelected(0);
    f.addCommandListener(this);
    }
    protected void initVars() {
    }
    /**
    *
    * @param c
    * @param event
    */



    public void actionPerformed(ActionEvent ae) {
    throw new UnsupportedOperationException("Not supported yet.");
    }

    protected void onWelcome_ButtonAction(Component c, ActionEvent event) {
    // If the resource file changes the names of components this call will break notifying you that you should fix the code
    super.onWelcome_ButtonAction(c, event);
    super.onWelcome_RadioButton1Action(c, event);
    super.onWelcome_RadioButtonAction(c, event);

    if (event.getCommand()==Enrollment.getCommand())
    { showForm("Authentication",null);

    }
    else if(Verification.getCommand() == event.getCommand())
    { showForm("Login",null);

    }

    else
    {
    Dialog.show("INFORMATION","Please select option","OK","CANCEL");
    }
    }

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,242
    Rep Power
    19

Similar Threads

  1. Radio button validation
    By javaguy345 in forum New To Java
    Replies: 5
    Last Post: 05-20-2011, 02:46 PM
  2. Disable Radio button
    By AJG in forum New To Java
    Replies: 3
    Last Post: 05-10-2011, 11:09 AM
  3. Radio Button
    By S-NESH in forum New To Java
    Replies: 6
    Last Post: 02-04-2011, 05:03 PM
  4. Radio Button help!
    By javanator in forum New To Java
    Replies: 3
    Last Post: 04-25-2010, 08:01 PM
  5. How to use SWT Radio Button
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-25-2008, 02:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •