public void closeWindow(){
  WindowEvent ev=new WindowEvent(frame,WindowEvent.WINDOW_CLOSING);
  frame.dispatchEvent(ev);
}

public void closeWindow ( ) { WindowEvent ev = new WindowEvent ( frame , WindowEvent . WINDOW_CLOSING ) ; frame . dispatchEvent ( ev ) ; }
closes the window ( and opendial ) .
