getPath() problem
i'm creating a file editor. i'm at a stage where i'm designing the 'save as' option.
whenever save as is clicked a FileChooser pops up with 'savedialog' and would allow the user to choose the directory and a name for the file.
after entering the file name when save is clicked, following gets executed..
int returnValue = filechooser.showSaveDialog(fc_frame);
if(returnValue == filechooser.APPROVE_OPTION)
{
File f = filechooser.getSelectedFile();
String temp = f.getPath();
temp = temp +"\\" + filechooser.getName() + ".txt";
w.write(temp);
this will get the path. example "c:\java", add "\" to it. then add the file name i have typed, example 'a' and then finally add '.txt' to it.
so the effect would be to creat a string like...C:\java\a.txt. but instead it adds "\null after each file name. so what happnes is...
"c:\java\a\null.txt
as a result, createNewFile() throws io exception.
to sum it up. i want to enter a the file name in the file chooser and when i hit save it should create a new file in the current direc tory.
can someone help me with this?
Neerav

