I was coding at work, and I needed a tree view of the file system so user’s could select a directory in a utlitiy I was writing. There’s nothing in the Java libraries that does that (as of JDK 1.6), so I figured this would be a cool little swing object to develop and make available for others. I finished it about a month ago, but I didn’t have time to thoroughly document it and make a page for it on my website until now.
I call it FileTree and it extends the Java
JTree class. It has the native system icons next to all the files and directories for OS X and Windows. On Linux, because neither the
File class or the
FileSystemView class return specific icons, some generic icons are used for the folder and file nodes.
I hope this library comes in handy for any Java developers out there, and if you find any bugs, make any improvements or have any interesting feature requests, please let me know about them.
- Enable/disable deleting of files and folders in the view
- Enable/disable showing of hidden files
- Enable/disable navigating into OS X application bundles
- Ability to not show files so you can force the user to select a directory