JFileChooser double click on file


Hi all
When I`m double clicking on a file shown at the JFileChooser  It act like it a directory and perform a drill down to it  ( and not choosing it of course)
How could I prevent it and actually choose the file when double clicking on it ?

Thanks
aquaswAsked:
Who is Participating?
 
objectsConnect With a Mentor Commented:
sounds odd, are you doning anything out of the ordinary in your code?
0
 
objectsCommented:
how is it drilling down on a file?
0
 
aquaswAuthor Commented:
It shows in the "Look In:" combo box the name of the file and and when you click on "Select", it can`t finf the file becasue it adding to the current dir the file name  as  directory

example:

If I open the file chooser in c:\1\ and I choose aa.xml , when double clicking on aa.xml the directory becomes c:\1\aa.xml\ and here it looking for aa.xml.

0
 
aquaswAuthor Commented:
UIManager.put("FileChooser.readOnly", true);
JFileChooser fc = new JFileChooser(<dir name>);
fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
fc.setMultiSelectionEnabled(false);
fc.setFileFilter(new XmlFileFilter());
fc.setDialogTitle("title");
0
 
aquaswAuthor Commented:
i solved it by removing the use with setFileSystemView method of FileChooser
0
All Courses

From novice to tech pro — start learning today.