aspose file tools
The moose likes Java in General and the fly likes File Chooser Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "File Chooser" Watch "File Chooser" New topic
Author

File Chooser

Durand Grimmett
Greenhorn

Joined: Jun 02, 2004
Posts: 16
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

Joined: Jun 02, 2004
Posts: 16
Sorry you guys....I jumped the gun, I just figured it out.....FileChooser.getSelectedFile().getName();

Thanks anyway,

DG
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: File Chooser
 
Similar Threads
folder chooser
is there Directory Chooser in swings?
using file chooser
jar file information
How to fetch information from a JAR file