title: JFileChooser check if really a File is selected?
body: <p>I noticed the following: If I start my application and go to open a file, then the <code>JFileChooser</code> appears. I tried writing a filename and I did not get an error, even though the file does not exist. What I get is a file path.</p>
  
  <pre><code> JFileChooser fileChooser = new JFileChooser();
      int values = fileChooser.showOpenDialog(null);
      File file = fileChooser.getSelectedFile();
  
      if (values == JFileChooser.APPROVE_OPTION) {
          System.out.println(file.getPath());
      } else if (values == JFileChooser.CANCEL_OPTION) {
          System.out.println("No file is selected");
      } else if (values == JFileChooser.ERROR_OPTION) {
          System.out.println("Error!");
      } else if (file == null) {
          System.out.println("No File is chosen");
      }
  </code></pre>
  
  <p>I hope you guys can help. I hope my question is clear because I have problems with explanations and with the English language.</p>