• Post Reply Bookmark Topic Watch Topic
  • New Topic

Filesystem in JTree  RSS feed

 
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: 9406
12
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!