Skip to content
Advertisement

Java how to user JFileChooser to save a excel file created by Apache POI

I want to save a spreadsheet file to a user custom file folder, people suggest to use JFileChooser, but I actually don’t know how to achieve it. I have my current example code here:

JavaScript

Currently it only save the file to the default project directory. But I want it to be saved to a user selected path with a user customized filename. JFileChooser seems like a good choice, but can someone show me how do I use it in my case?

Advertisement

Answer

JavaScript

When we want to use it to save a file, we need:

JavaScript
Advertisement