title: Starting a JFileChooser at a specified directory and only showing files of a specific type
body: <p>I have a program utilizing a JFileChooser. To be brief, the full program is a GUI which allows users to manipulate PNGs and JPGs. I would like to make it so that the JFileChooser instantly opens to the picture directory (windows). When the user opens their JFileChooser, it would open directly to the pictures library C:\Users\(USER)\Pictures</p>
  
  <p>Furthermore, it would be nice to ONLY show files of a specific type (PNGs and JPGs). Many programs seem to be able to do this; only allowing selection of specific files. Does JFileChooser allow such a thing? Currently, I am using a massively unreliable, run around method to reject non-PNGs/JPGs.</p>
  
  <p>The following refers to the "browse" button of the GUI, in which a user will select their picture for editing and it will display it on the screen.</p>
  
  <pre><code>    try {
         int val = filec.showOpenDialog(GridCreator.this);
         if(val==JFileChooser.APPROVE_OPTION) {
            File unfiltered_picture = filec.getSelectedFile();
            //get the extension of the file
            extension=unfiltered_picture.getPath();
            int index=extension.indexOf(".");
            extension=extension.substring(index+1, extension.length());
            //if the file is not jpg, png, or jpeg, reject it and send a message to the user.
            if(!extension.matches("[jJ][pP][gG]") &amp;&amp; !extension.matches("[pP][nN][gG]") &amp;&amp; !extension.matches("[jJ][pP][eE][gG]")) {
               JOptionPane.showMessageDialog(null,
                                             "cannot load file. File must be of type png, jpeg, or jpg. \n Your file is of type " + extension,
                                              "Error: improper file",
                                              JOptionPane.OK_OPTION);
             //if the file is of the proper type, display it to the user on the img JLabel.
             } else {
                finalImage = ImageIO.read(unfiltered_picture);
                ImageIcon imgIcon = new ImageIcon();
                imgIcon.setImage(finalImage);
                img.setIcon(imgIcon);
                img.invalidate();
                h_divide.setValue(0);
                v_divide.setValue(0);
             }
         }
     } catch(IOException exception) {
          exception.printStackTrace();
     }
  </code></pre>
  
  <p>Thank you.</p>