posted 23 years ago
Does anyone know how to make sure that the filename that someone enters into a JFileChooser ends with the right extension? In my application, I want people to be able to save a .jpg file. I can make the JFileChooser show only directories and jpg files, but when a user goes to type in a filename, if he doesn't type ".jpg" after it, it's saved without an extension.
I figured one way to do this would be to just change the name of the File object after the JFileChooser has closed. I thought there would be a setName method in the File object, but there's not -- just a getName method.
Any help would be greatly appreciated.
Thanks,
Chris