Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File Chooser

 
Durand Grimmett
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

Im using a File Chooser to allow users to select a directory and to name a particular jar file. However, I want to capture the name of the jarfile that they input into the textField within a string variable. Right now if I do a textFieldName.getText(); .........it will return me the entire path to the jar file. I just want the name of the jar file. I considered using the subString method, but this wouldn't be efficient in my case because the length of the path and the name of the file will most likely be different in each case. I was wondering if anyone has any suggestions in this matter? I also noticed that the FileChooser Class does contain a getName method, but this didn't work for me either. Any suggestions?

Thanks in advance,

DG
 
Durand Grimmett
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry you guys....I jumped the gun, I just figured it out.....FileChooser.getSelectedFile().getName();

Thanks anyway,

DG
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic