Link to home
Start Free TrialLog in
Avatar of aquasw
aquasw

asked on

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
Avatar of Mick Barry
Mick Barry
Flag of Australia image

how is it drilling down on a file?
Avatar of aquasw
aquasw

ASKER

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.

ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of aquasw

ASKER

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");
Avatar of aquasw

ASKER

i solved it by removing the use with setFileSystemView method of FileChooser