title: java thread.sleep puts swing ui to sleep too
body: <p>I im creating a simple testing app that runs a check every hour on the selected directory/s using thread.sleep() through JFileChooser. But when i select the directory and the method runs the ui panel goes grey and the swing bits disappear. The thread seems to be putting the ui to sleep as well as the method its calling.</p>
  
  <pre><code>if (option == JFileChooser.APPROVE_OPTION) {
      selectedDirectory = chooser.getSelectedFiles();
      try {
          while (true) {
              runCheck(selectedDirectory);
              Thread.sleep(1000*5);//1000 is 1 second
          }
      } catch (InterruptedException e1) {
          Thread.currentThread().interrupt();
          e1.printStackTrace();
      }               
  } 
  </code></pre>
  
  <p>Im looking for a way around this issue so that i can print the results of the checks being run in the ui .setText(result)</p>