title: JFileChooser click programmatically on open
body: <p>I have following code to open a JFilechooser    </p>
  
  <pre><code>chooser = new JFileChooser();
  chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
  chooser.setAcceptAllFileFilterUsed(false);
  chooser.showOpenDialog(null);
  String path = chooser.getSelectedFile().getPath();
  </code></pre>
  
  <p>What I want to do is programmatically close this dialog. I see the open button, but how can I "press" it programmatically?</p>