I think the problem is that you never take the selected file. You just setSelectedFile on a file created after a hardcoded name. After that you instantiate a writer on those file but the problem is that the chosen file is not taken. Actually the file you are writting to is File(filename) which is created in the project's root directory.
Try adding this to your try block:
writer = new BufferedWriter(new FileWriter(saveFile.getSelectedFile()));
insted of this:
writer = new BufferedWriter(new FileWriter(filename,
false));