Get user-inputed file name from JFileChooser Save dialog box

Posted by Anya on Stack Overflow See other posts from Stack Overflow or by Anya
Published on 2010-05-27T04:21:39Z Indexed on 2010/05/27 5:01 UTC
Read the original article Hit count: 379

Filed under:
|
|
|
|

This answer to this question may seem obvious, but I'm actually struggling with it quite a bit. I've searched through JFileChooser methods in the API, and I've looked at some of the questions already asked and answered here on stackoverflow.

My question is this. In my program, I am to allow the user to type in a file name which I will then use to create a brand new file that I will write on. How do you get the text the user has entered in the textfield next to the label "Save As:" on the Save dialog box provided by JFileChooser? Is there a JFileChooser method that would allow me to get that user-inputed text? Or would I have to go through another class, or do something else to get that text?

Thank you so much, to anyone who answers. It's very late for me now, and this program is due in a few hours (meaning I'll be having another sleepless night). Desperate may be too strong a word, but I'm something close enough.

© Stack Overflow or respective owner

Related posts about text

Related posts about save