title: Java: How to read "Files of type" in JFileChooser
body: <p>I want to create a new file while file type is choosing by the user on JFileChooser. How this is possible. I use this code for JFileChooser:</p>
  
  <pre><code>JFileChooser chooser = new JFileChooser();
  chooser.setDialogTitle("Save data in your file format");
  
  FileFilter type1 = new ExtensionFilter("Access 2007 Database(*.accdb)", ".accdb");
  FileFilter type2 = new ExtensionFilter("Access 2002-2003 Database(*.mdb)", ".mdb");
  
  chooser.addChoosableFileFilter(type1);
  chooser.addChoosableFileFilter(type2);
  
  int actionDialog = chooser.showSaveDialog(frame);
  </code></pre>
  
  <p>Now I an able to get the "File Name" when the user select any file by this code:</p>
  
  <pre><code> chooser.getSelectedFile().getName();
  </code></pre>
  
  <p><strong>But I dont know how to get "Files of type" when user select any file.</strong>
  For the convenience I also attach photo of JFileChooser:
  <img src="https://i.stack.imgur.com/J58Vn.jpg" alt="enter image description here"></p>