JFileChooser and file filter events

A

Anand Gopinath

Hi,

I was wondering if anyone could tell me if there is a way to accomplish
what I am doing.

I want to display a default filename (for the user to save) to the user
and let it stick around if the user changes the file filter.

To do that, I have a JFileChooser and I set a default filename when it
is presented to the user. That file probably does not exist, I use the
setSelectedFile( File ) call to do that. That sets the name in the
File Name text field.

The problem I am having is this: when the file filters are changed, the
filename I set gets cleared. I would like to set it back to what it was
once the file filter does its thing. I listen to the properties
FILE_FILTER_CHANGED_PROPERTY and the SELECTED_FILE_CHANGED_PROPERTY to
get the old filename and that works once the user actually selected a
file. It does not work for the filename I set or anything else the user
might be typing into the File Name text field.

Is there a way to get the text in the File Name text field when the file
filter is changed?

Thanks,

Anand
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top