title: JOptionPane.showMessageDialog wait until OK is clicked?
body: <p>This might be a very simple thing that I'm overlooking, but I just can't seem to figure it out. </p>
  
  <p>I have the following method that updates a JTable:</p>
  
  <pre><code>class TableModel extends AbstractTableModel {    
          public void updateTable() {
              try {
                  // update table here
               ...
      } catch (NullPointerException npe) {
                  isOpenDialog = true;
                  JOptionPane.showMessageDialog(null, "No active shares found on this IP!");
                  isOpenDialog = false;
              }
          }
      }
  </code></pre>
  
  <p>However, I don't want <code>isOpenDialog</code> boolean to be set to false until the OK button on the message dialog is pressed, because if a user presses enter it will activate a <code>KeyListener</code> event on a textfield and it triggers that entire block of code again if it's set to <code>false</code>. </p>
  
  <p>Part of the KeyListener code is shown below:</p>
  
  <pre><code>public class KeyReleased implements KeyListener {
          ...
  
      @Override
      public void keyReleased(KeyEvent ke) {
          if(txtIPField.getText().matches(IPADDRESS_PATTERN)) {
              validIP = true;
          } else {
              validIP = false;
          }
  
          if (ke.getKeyCode() == KeyEvent.VK_ENTER) {
              if (validIP &amp;&amp; !isOpenDialog) {
                  updateTable();
              }
          }
      }
  }
  </code></pre>
  
  <p>Does <code>JOptionPane.showMessageDialog()</code> have some sort of mechanism that prevents executing the next line until the OK button is pressed? Thank you.</p>