JFileChooser double click on file

Posted on 2007-07-24
Last Modified: 2008-03-10

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 ?

Question by:aquasw
    LVL 92

    Expert Comment

    how is it drilling down on a file?

    Author Comment

    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


    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.

    LVL 92

    Accepted Solution

    sounds odd, are you doning anything out of the ordinary in your code?

    Author Comment

    UIManager.put("FileChooser.readOnly", true);
    JFileChooser fc = new JFileChooser(<dir name>);
    fc.setFileFilter(new XmlFileFilter());

    Author Comment

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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Suggested Solutions

    After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
    Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
    This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
    This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now