title: Using joptionpane to exit the program
body: <p>I have a gui java program that count the number of files (if any) in a folder and store their names in an array for processing. In the case when no files are available to process, I want to display a joptionpane with the message " No files are available to process. Please click the exit button to exit the system ".</p>
  
  <p>How can I exit the system when the user click the button of the joptionpane?
  Something like</p>
  
  <pre><code>if (array.length == 0){
      JOptionPane.show .......
      {
          System.exit(0);
      }
  }
  </code></pre>