This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
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
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. cheers