hmmm. . . I cant seem to undestant the code. im sorry. Im a little sick. The return value of the .getSelectedFile() is in file data type. If you want to use it as string you should convert it toString first. Sorry if i cant give much help.
else if(command.equalsIgnoreCase("Save As")){
result = fileChooser.showSaveDialog(this);
if (result == JFileChooser.CANCEL_OPTION) {
return;}
filename=fileChooser.getSelectedFile();
ext = fileChooser.getFileFilter();
Save();
}
Here is a sample. i got the filename with the directory using getSelectedFile();
and got the extention using the getfilterfile. *Note: You must declare a filter if you want to filter the extensions. Then call my Function.