Thread: Dumb Netbeans Q
View Single Post
  #17 (permalink)  
Old 05-26-2008, 12:08 PM
Eku Eku is offline
Senior Member
 
Join Date: May 2008
Location: Makati, Philippines
Posts: 228
Eku is on a distinguished road
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.

Code:
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.
__________________
Mind only knows what lies near the heart, it alone sees the depth of the soul.
Reply With Quote