Currently using JFileChooser
to save a file to the users system. Issue is that the user interface it uses to select the file destination is the ugly Swing UI and not the Windows file explorer UI. Is there an attribute that I can easily change for the JFileChooser
.
Below is my code:
JFileChooser fileChooser = new JFileChooser();
fileChooser.setDialogTitle("Specify a file to save");
int userSelection = fileChooser.showSaveDialog(this);
if (userSelection == JFileChooser.APPROVE_OPTION) {
fileToSave = fileChooser.getSelectedFile();
String filePath = fileToSave.getPath();
if(!filePath.toLowerCase().endsWith(".csv"))
{
fileToSave = new File(filePath + ".csv");
}
}
I have also defined fileToSave
earlier and the code all works, this is purely a cosmetic issue.