title: Java While Loop checks the time but not performing a method
body: <p>In this code a while loop is supposed to check the time, and if the time is equal to 7 PM, then display a message box.</p>
  
  <pre><code>public void actionPerformed(ActionEvent arg0) {
  
      Enable.setEnabled(false);
      Date d = new Date();
      int hrs = d.getHours();
      int mins = d.getMinutes();
  
          while((1 + 1) == 2) { 
              if(hrs == 19 &amp;&amp; mins == 21) {
                  JOptionPane.showMessageDialog(frame,
                      "It's 7:21 PM!",
                      "Alerts",
                      JOptionPane.WARNING_MESSAGE);
                  System.exit(0);
                  break;
              }
          }
  }
  </code></pre>
  
  <p>Pushing a button will do that code. If you push the button before it is 7 PM, the GUI will freeze (I don't care about that), and when it turns to 7 PM, it won't display the message box. If you click the button when it <em>is</em> 7 PM, then it will display the message box...</p>