Start New Discussion within our Software Development Community

program is working fine on YES option but on NO option it does not return ? any one give me hint ??

this.addWindowListener(new WinAdapter(){
    public void windowClosing(WindowEvent e){

        String cnic1 = (String)cnic.getValue();
        String name1 = name.getText();
        String fname1 = fname.getText();
        String age1 = (String)age.getValue();
        String add1 = add.getText();
        String pro1 = pro.getText();

    if (cnic1 != null || name1.length() != 0 || fname1.length() != 0 || age1!= null || add1.length() != 0 || pro1.length() != 0){

    int n = JOptionPane.showConfirmDialog(RForm.this, "You have not save your Entry, Would you like to Exit!", "Voter Registration Form", JOptionPane.YES_NO_OPTION);

        if (n == JOptionPane.YES_OPTION){
             System.exit(0);

        } else if (n == JOptionPane.NO_OPTION){

        [COLOR="Red"][B]return;[/B][/COLOR]

        }

        }else{

            System.exit(0);
        }
        }

    });

How do you know it's not returning? Because this is part of a window closing event how would you expect a return to manifest itself?
Anyway, put a print statement just before the return to see if its being executed.

This question has already been answered. Start a new discussion instead.