title: Appending the file type to a file in Java using JFileChooser
body: <p>I'm trying to save an image using a JFileChooser. I only want the user to be able to save the image as a jpg. However if they don't type .jpg it wont be saved as an image. Is it possible to somehow append ".jpg" to the end of the file? </p>
  
  <pre><code>File file = chooser.getSelectedFile() + ".jpg";  
  </code></pre>
  
  <p>Doesn't work as I'm adding a string to a file. </p>