I have a Save As... function in my text editor. I would like to do a Save As, save to a new file, but then my permanent file to save to should now always be this new file. So when I click my other button, Save, instead of saving to the previous location is will continue to save to the location which was selected with JFileChooser.
I have a File object called currentFile which should link to the file chosen via Save As. I am currently making sure of that by creating a file called fileName in my button action performed function, and then setting the currentFile to that file
File fileName = new File(fileChoice.getSelectedFile() + ".txt");
currentFile = fileName;
I was wondering if I could achieve the same thing without creating new file..? It appears to me that the new file creation follows the File(String pathname)
constructor, yet there seems to be no method to set pathname of the file.