Question

i have a save file dialog in my griffon app. the code is like this:

    String filename = siteCode+'-'+model.currentClient.name+'-'+computerName+'-'+date+'.csv'
    File selFile = new File(filename)
    def fc = new JFileChooser()
    fc.setSelectedFile(selFile)
    fc.showSaveDialog()



    BufferedWriter out = new BufferedWriter(new FileWriter(selFile));

The problem is, regardless the path i choose to save file at, it alsways goes to the "Staging" directory in my app's folder.

Was it helpful?

Solution

Could it be that you're not reading back the selected file from the dialog but reusing the selFile variable? Make sure you call fc.getSelectedFile() instead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top