I don't understand what you mean by "add a file type to a file". So perhaps you could back up and explain your problem. What exactly is it that you see, where do you see it, and what would you like to see differently?
Ok, I will describe it in detail.
A user clicks 'save the image' option. Then JFileChooser pop-ups and he chooses the path and file name. Next, he clicks OK. But the image is saved without extension: 'myimage' unless the user scecify it. I want to add that extension '. png' automtically. There is a simple way to filter files during opening but what about saving?
After the user pressed OK you can get the file using getSelectedFile(). You can check the file's name, and create a new File object if the extension doesn't match: