I have a JButton which opens JFileChooser and that in turn selects a file into a variable called "file".
I want to rename the selected file to "Best.html" and then provide it to TableToCSV.java (java TableToCSV.class Best.html), which will convert the selected file to a .csv format.
Here is my code -
final JFileChooser fileDialog = new JFileChooser();
JButton btnInputFile = new JButton("Input File");
btnInputFile.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
int returnVal = fileDialog.showOpenDialog(rootPane);
if (returnVal == JFileChooser.APPROVE_OPTION) {
java.io.File file = fileDialog.getSelectedFile();
}
}
});
Note - I want to rename because the TableToCSV.java file only inputs file with a .html extension.
Note - TableToCSV.java lies in the same folder as my java program.