wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Jtree Help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Jtree Help" Watch "Jtree Help" New topic

Jtree Help

Sandeep Jain
Ranch Hand

Joined: Oct 25, 2000
Posts: 124
Hello Everyone,
I am stuck with a requiremnt where by I have to show a directory structure in a tree format however the each directory or a file has a unique number with which it is recognised.
Now how do I set a different export value for each node or a directory .
Please help me out as it is very important .

Try and Try Till u succeed<br /> <br />Sandeep Jain
Chantal Ackermann
Ranch Hand

Joined: Sep 28, 2000
Posts: 508
The MutableTreeNode has the attribute userObject where you can store anything that describes the object represented by the node.
you should write your custom TreeNode (by implementing the appropriate interface (be aware that you have to implement all the listener methods as well) or extending DefaultMutableTreeNode (event/listener are handled in this case but the class is quite complex)). and moreover a custom TreeModel that handles the data (= the nodes). changes made to the data is displayed at once in the JTree and vice versa. see the swing tutorial on TreeModels.
it might sound more difficult than it is, just give it a shot.
I agree. Here's the link: http://aspose.com/file-tools
subject: Jtree Help
Similar Threads
How to list all directories in a webapp
How to read a text file from the system and load the data in to a table in oracle
eclipse, open a file outside a project
highlighting files
How To Crate a Directory Tree In Java Swing