Hi, Does anyone out there know how to stop a jtree showing it's leaf nodes. I want to create a menu system, similar to a file explorer, but I don't want the tree to display the child nodes, instead I want these to be displayed in a seperate panel. I have done some searching in the code, and have not been able to come up with anything so any help would be appreciated. Thanks in advance Brian
I'd think your model is what you want to look at. It tells the View what to display. For example, you probably don't want to display files in the tree, so don't add them to the model. When someone selects a particular directory you can scan it and display all its contents, files and directories, in the next frame.
Hi I had the following situation root -node1 -----node1leaf -node2 -----node2leaf -node3 -----node3leaf I hid the root (it was just my defined starting point to add my nodes). Each node had the text data that I wanted the user to see and each node had one leaf that contained the nodes IDKey (unique identifier). Since I didnt need the leaves to be shown, I could restrict this by setting the click count to 0 or -1 (sorry cant remember for sure which one). This prevented the nodes from being expanded, but allowed me to retrieve the code from the leaf (when selected) and then set up another separate screen with the relevant details according to the code. It might not be the worlds most attractive solution but hey... it works like a beauty. Chris [ November 25, 2003: Message edited by: Chris Brat ] [ November 25, 2003: Message edited by: Chris Brat ]