Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

creating directory using JFileChooser  RSS feed

 
rachita mahendru
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dear friend here is the code i had written but its not working
JFileChooser obj_FileChooser = new JFileChooser(".");
obj_FileChooser.setDialogTitle("Project files");
obj_FileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
iReturnVal = obj_FileChooser.showDialog(frame, "Save Project");
if(iReturnVal == obj_FileChooser.APPROVE_OPTION)
{
System.out.println("inside approve option");
str = obj_FileChooser.getSelectedFile().getPath();
f1 = obj_FileChooser.getSelectedFile();
int dot = str.indexOf(".");
if ( dot > 0 )
JOptionPane.showMessageDialog(frame,"You should specify the project name","Warning Message",JOptionPane.WARNING_MESSAGE);
else
{
f1.mkdir();
lv.projectname = str;
projecttf.setText(lv.projectname);
}
}
the code is not entering in the loop if i write a new string in the "filename" textfield of the JFileChooser. and hence i am unable to create a new directory with that name.
regards
rachita
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!