Basically i'm wondering if i can fill the "File Name" field of a JFileChooser automatically. I'm pulling files from another machine using sftp, and specifying the file to be created with the JFileChooser. So that the file i'm transfering will be saved with the name and location i specify. As the JFileChooser pops up to pick though i'd like to set a default directory, and name. Is this possible?

Thanks

Recommended Answers

I think there are methods in the class to do that.

Jump to Post

All 3 Replies

I think there are methods in the class to do that.

Thanks! Now that i've looked i see the contructor can be used to set the default directory, still looking on the file name though.

setSelectedFile(File f) is what you seem to be looking for.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.