title: JFileChooser choose empty file
body: <p>I'm using a JFileChooser as the editor for a JTable cell. I'd like the user to select a valid file using JFileChooser, then when they hit enter, the file path is saved to the cell. This presents a problem if they want to clear the cell. So i want them to clear out the JFileChooser and that will set the cell with the empty string (or null, whichever).</p>
  
  <p>My problem is that if you haven't selected a file, you can't press the Approve button. In my code, "empty!" is never printed. Is there a way to do allow the approve button selected when no file is selected? Here's what I've tried:</p>
  
  <pre><code>JFileChooser component = new JFileChooser(){
          public void approveSelection(){
              File f = getSelectedFile();
              if(f==null){
                  System.out.println("empty!");
                  return;
              }else{
                  if(!f.exists()){
                      System.out.println("does not exist!");
                  }else{
                      super.approveSelection();
                  }
  
              }
          }
      };
  </code></pre>