Question

I'm working on an application that visualizes datasets which are stored in directories ending with ".D"

I would like my jFileChooser to NOT enter into such directories and instead act like it would when you double click regular files.

So far I was not successfull. I did override getIcon to give them specific icons. But I did not find how to implement the double clicking.

So far I tried to use a FileFilter to only accept these directories - but then I loose the ability to navigate the file system. I also tried to override isNavigable() to return false for these directories - but then they do not show up anymore.

Would be really gratefull for a hint.

Was it helpful?

Solution

You may need to override the FileView.isTraversable() function to return false for those directories. From the comments in the javadoc, it seems that this is what you want to do if you want a certain directory to represent a compound document.

http://docs.oracle.com/javase/6/docs/api/javax/swing/filechooser/FileView.html#isTraversable(java.io.File)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top