Possible Duplicate:
How to programmatically close a JFrame
I am developing a java GUI using JFrame. I want to close the GUI frame and dispose it off through code. I have implemented :
topFrame.addWindowListener(new WindowListener()
        {
            public void windowClosing(WindowEvent e)
            {
                emsClient.close();
            }
            public void windowOpened(WindowEvent e) {
            }
            public void windowClosed(WindowEvent e) {
            }
            public void windowIconified(WindowEvent e) {
            }
            public void windowDeiconified(WindowEvent e) {
            }
            public void windowActivated(WindowEvent e) {
            }
            public void windowDeactivated(WindowEvent e) {
            }
        });`
How can I invoke the windowClosing event?? Or is there some other way?
 
     
     
     
     
    