title: Stop JDialog blocking without closing
body: <p>I'm currently doing an assignment which involves implementing some board game in Java. We have to work around the interfaces the lecturer has given us. The actual 'UI' class is separate from the game logic and is launched in the main thread. Originally this class extended JFrame. When the user pressed enter, a boolean was set to show that he/she has made their move, and the main thread waited in a while loop repeatedly polled the JFrame to see if the user has made his move:</p>
  
  <pre><code>while (!input.moveEntered())
  {
      //sleep for 100ms
  }
  move.setPosition(input.getX(), input.getY());
  return move;
  </code></pre>
  
  <p>This was very obviously not the way to go about it, and thanks to some help I got from a previous question (<a href="https://stackoverflow.com/questions/36419330/waiting-for-a-jframe-and-then-retrieving-information-from-it">Waiting for a JFrame and then retrieving information from it</a>) I started using a modal JDialog. The fact that setVisible() blocks is good, however it seems that JDialogs are for single inputs. Is there any way to stop blocking the main thread without ending the setVisible method and closing the window? I need the window to stay open in-between moves:</p>
  
  <p><a href="https://i.stack.imgur.com/PRPDm.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PRPDm.gif" alt="Please stop flashing"></a>
  Thanks in advance.</p>