static EventObject jdialog(JFrame owner,String title,JComponent body,JComponent ...ok){
     JDialog dialog = new JDialog(owner,title);
     dialog.setContentPane(body);
     dialog.pack();
     if(owner!=null)dialog.setLocationRelativeTo(owner);
     else centerLocation(dialog);
     
     JEventQueue events = new JEventQueue();
     if(ok!=null&&ok.length!=0){
        for(int i=0;i<ok.length;i++)
          events.listenTo(ok[i],"ok"+i);
     }
     dialog.addWindowListener(events);
     dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
     
     dialog.setVisible(true);
     EventObject e;
     do{
       e= events.waitEvent();  
     }while((e instanceof WindowEvent)&&(((WindowEvent)e).getID()!=WindowEvent.WINDOW_CLOSING));
     dialog.dispose();
     return e;
  }