In this code, in the class "SaveOperation" I am trying to save a text file in a user defined location. But I am not getting anything as an output, not even an error! Apart from that, I am trying to save this in using a already given name by me, but I doubt whether it will work because the save window has a place to enter the file name. Please help.
However that isn't relevant to your problem. Unfortunately your description of the problem doesn't say "I saw the dialog box from line 216" or "I saw the dialog box from line 222" or "I didn't see either of those dialog boxes". Whichever of those is true tells you which code was executed. This is the information you need.
Edit: Also I think you should fix your code so the user can only choose a directory in that class.
Hi, Thanks a lot for the reply. I see that save dialogbox when I click the button. But when I click the "save" button in the save box, nothing happens! It is not getting closed, no error, nothing get saved! Please help..
And thanks for the correction of the IO part. I will edit it.
Okay. So line 216 isn't run and neither is line 222. Look at your code, then. What would cause that? Well, they are both controlled by an if-statement which I expect you are making a false assumption about.
JFileChooser's save dialog is modal, so the fileSelectionMode will be set only after the dialog is shown and dismissed. I'm guessing that isn't what you wanted, but it's difficult to tell with so much code that's irrelevant to the stated problem. Learn to write an effective SSCCE and you'll get better help sooner.
Also note that your title is off the mark: JFileChooser, as its name implies, is for choosing (or selecting) a file. Not for saving one.
Thanks a lot for the help and pardon me for the late reply. As you all suggested, the error was inside the MAIN IF condition. I had to call that "ApproveOption()" method manually, and it worked.. Thanks a lot for all the help.. I really appreciate it..