File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes generate a tree structure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "generate a tree structure" Watch "generate a tree structure" New topic
Author

generate a tree structure

Pravin Shirke
Ranch Hand

Joined: Apr 05, 2008
Posts: 150

hi guys,
i want to generate the tree structure of directory. e.g. if directory is home and it has many sub directory i want to display all the sub-directories in a directory and so on till all are display. i am able to find out the directory. but the problem is how should i trace in until the last directory in a directory. like home/a/b/c/d..... until all the directories are exhausted.


[Vipassana] - It is seeing the reality as it is, And not as you want it to be.!!!
SCJP1.5.
Piyush Porwal
Ranch Hand

Joined: Apr 09, 2008
Posts: 30
Think recursively
Just consider one level at a time. Display contents of a node and then (recursively) for all its children (sub-dir) call this same method.


-Piyush Porwal (Junk box)
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41509
    
  53
Are you asking about a web GUI or a Java GUI?


Ping & DNS - my free Android networking tools app
Pravin Shirke
Ranch Hand

Joined: Apr 05, 2008
Posts: 150

hi ulf,
i am using java GUI Swings API for that.
Piet Verdriet
Ranch Hand

Joined: Feb 25, 2006
Posts: 266
pravin shirke wrote:hi ulf,
i am using java GUI Swings API for that.


Have a look at this article:
http://java.sun.com/products/jfc/tsc/articles/treetable1/index.html
and/or:
http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: generate a tree structure