Re: Choosing specific file in JFileChooser



Great answer Andrew. Dushkin, you may also want to have a look at the
JFileChooser object's method called "setAcceptAllFileFilterUsed" to
eliminate the "*.*" all files. A couple of other points you may want to
look at are:

(1) setFileSelectionMode(JFileChooser.FILES_ONLY)
and (2) when implementing the FileFilter return true if the
pathname.isDirectory() || equals pathname.getPath().equals("win.ini").

Cheers,

Dan Andrews

- - - - - - - - - - - - - - - - - - - - - - - -
Ansir Development Limited www.ansir.ca
- - - - - - - - - - - - - - - - - - - - - - - -

Andrew Thompson wrote:
dushkin wrote:
..
I need to allow the selection of only specific file name from a
JFileChooser dialog.
For example, I want to let the user choose only "win.ini" file
..

The JavaDocs for JFileChooser show a small example
of using FileFilter.

Andrew T.

.