i have this issue working but i would like to know if there is a better way of adding the file extension?
what i am doing right now is:
String filePath = chooser.getSelectedFile().getAbsoluteFile() + ".html";
im adding the extension hard coded. and then saving to it.
just wondering if there is a more robust/logical manner this can be implemented?
thank you for your time.
EDIT: i ask this as i would like my app to be portable across platforms. so adding .html manually i may make this a windows only solution.
EDIT: i think ive surfed enough to know that .html hard coded is safe as i havent found any documentation that says dont take this approach (not completely sure).
ISSUE: also if i want to save the file in another format, text, for example how do i detect that the user selected which format?
FileNameExtensionFilter can add filters to the dialog but how do i get the return value for file type selected?
EDIT: i have studied this but still unclear how to retrive user selected file type.
EDIT: this is a rephrase of my issue:
my question is how can i retrieve/find out which one of the two filters the user has selected as the save format. HTML or JPEG? how do i retrieve this info from JFileChooser? thank you.
EDIT: found something out: it has something to do with JFileChooser.getFileFilter() your help still welcome.
EDIT: getFileFilter() and FileNameExtensionFilter comparasion solved this issue.