title: Exception in thread "AWT-EventQueue-0" java.lang.IllegalMonitorStateException at java.lang.Object.notify(Native Method)
body: <p>What I'm trying to do:</p>
  
  <p>Launch a window to request parameters</p>
  
  <p>What I've tried:</p>
  
  <ol>
  <li>If I remove the <code>vp.wait()</code>, the window disappears.</li>
  <li>If I remove <code>notify()</code>, the program doesn`t wait.</li>
  </ol>
  
  <p>Here's my code:</p>
  
  <pre><code>public static void main(String[] args) throws InterruptedException{
      if(args.length==0){
          ParamsWind vp = new ParamsWind();
          vp.setVisible(true);
          synchronized (vp){
               try {
                  vp.wait();
              } catch (InterruptedException e) {
                  e.printStackTrace();
              }
          }
   .....
  
  
  public class ParamsWind extends JDialog {
    ...
    public ParamsWind() 
      ....
         //Create Ok Button and program Action Listener
      Button ok = new Button("OK");
      ...
      ok.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent arg0) { 
  
              if(f.getText().equals("") || r.getText().equals("")){
                  ErrorWind verr = new ErrorWind();
                  verr.setVisible(true);
              }
              notify();
  </code></pre>