Results 1 to 3 of 3
- 07-26-2011, 01:07 AM #1
Member
- Join Date
- Jul 2011
- Posts
- 1
- Rep Power
- 0
OS-independently display a file system in a JTree view
Hi everyone,
I've come across numerous references regarding the basics of how to create a JTree file system display, but is there a good reference for building one that will successfully display the file system regardless of whether the application is executed on OS X, Linux, or Windows? Is something like that even supported using the Swing library?
- 07-26-2011, 02:19 AM #2
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,547
- Rep Power
- 11
I guess you would make a TreeModel subclass the implementation of whose methods would depend heavily on a FileSystemView instance supplied when it was created. You would probably want a subclass of DefaultTreeCellRenderer that would rely on the file system view to display labels and icons appropriately.
- 07-26-2011, 06:10 PM #3
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,609
- Rep Power
- 5
Google "JTree file system"...there are many code examples which demonstrates how to use a JTree to display the file system, and if you use the File class it should be relatively straightforward. You would need to define what the root of the tree is however...you could define this for the platform, or use the System.getProperty("user.home");
Similar Threads
-
JTree only display .txt
By collin389 in forum AWT / SwingReplies: 2Last Post: 12-04-2009, 09:50 PM -
How to display all TreePath's in JTree?
By sergey in forum AWT / SwingReplies: 2Last Post: 11-05-2009, 06:09 AM -
How to use Jtable to display File System as Total Commander?
By antiZzz in forum Advanced JavaReplies: 1Last Post: 01-16-2009, 05:44 PM -
How to display a file system in a JTree view
By Java Tip in forum javax.swingReplies: 0Last Post: 06-27-2008, 07:43 PM -
how to display data in Jtree
By paty in forum New To JavaReplies: 1Last Post: 07-24-2007, 12:28 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks