Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Filesystem in JTree

 
Martin Kogut
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
how could I display the whole Filesystem in my JTree? The metod
File = new File.listRoots(); shows me only my harddrives, but I want to have the whole entry of them!
Thanks alot...
 
Joe Ess
Bartender
Posts: 9362
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no method which will traverse the file system for you. You have to take each root in turn and get its contents, determine if those contents are directories or files, then get the contents of the directories and so on.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could start by looking at the JTreeTable example which also has a Part 2.

Also, the new JDIC has a cross platform file viewer that allows the user to browse files and folders on the OS. IF you could use that, that would be easiest.
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!