×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    May 2009
    Posts
    115

    Dialog problem LWUIT

    Hello


    When user clicks "yes" command button, a dialog button opens successfully and when the user click "no" command button, the dialog buttons disappers.Unfortunately, after I click "no" button it will try to reopen dialog again or it will try to click "yes" command button again and it gives following error :
    Code:
    import com.sun.lwuit.Command;
    import com.sun.lwuit.Dialog;
    import com.sun.lwuit.Display;
    import com.sun.lwuit.Form;
    import com.sun.lwuit.Label;
    import com.sun.lwuit.events.ActionEvent;
    import com.sun.lwuit.events.ActionListener;
    import javax.microedition.midlet.*;
     
     
    public class Midlet extends MIDlet implements ActionListener {
     
     
        public void startApp() {
              Display.init(this);
            final Form f = new Form("Hello, LWUIT!");
      Label lbl1=new Label("ALPER");
     
            final Dialog dlg = new Dialog("title");
            dlg.addComponent(lbl1);
            dlg.addCommand(new Command("NO"){
               public void actionPerformed(ActionEvent ev) {
                  dlg.dispose();
                  f.show();
                }
            });
          Command yes = new Command("YES");
              Command exitCommand = new Command("Exit");
     
        f.addCommand(new Command("YES") { //command yes = new command ("yes") yerine bunu diyiceksin işte !!!
     
                public void actionPerformed(ActionEvent ev) {
                    dlg.showDialog();
                }
            });
     
                f.addCommand(exitCommand);
     
            f.setCommandListener(this);
             f.show();
        }
     
        public void pauseApp() {
        }
     
        public void destroyApp(boolean unconditional) {
        }
     
        public void actionPerformed(ActionEvent ae) {
            throw new UnsupportedOperationException("Not supported yet.");
        }
    }

  2. #2
    Regular Contributor
    Join Date
    May 2009
    Posts
    115

    Re: Dialog problem LWUIT

    Hello


    I fixed the problem by removing " f.setCommandListener(this);". Cheers anyway...

Similar Threads

  1. Lwuit problem
    By ingsaurabh in forum Mobile Java General
    Replies: 17
    Last Post: 2011-04-20, 13:46
  2. problem in LWUIT
    By sadeghvaziri in forum Mobile Java General
    Replies: 3
    Last Post: 2010-08-20, 18:05
  3. Problem using LWUIT
    By rachelwiz in forum Mobile Java General
    Replies: 5
    Last Post: 2010-04-09, 05:12
  4. Scroll problem in Dialog Box (LWUIT)
    By madhukv in forum Mobile Java General
    Replies: 8
    Last Post: 2009-08-26, 10:53

Posting Permissions

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