The JTree is read from an XML document. And it can change dynamically depending on the XML document read, the JTree will show accordingly. There are somemore subnodes for Junction element, but for example, i want to stop at junctionType node. How do i do that? I have read several examples from other forums and tried but to no avail.
Another question: After i display this subtree, i want to link and display the remaining subtree by clicking a button, again display a small section of the subtree, by a count of 10 nodes by a refresh of the JTree. IThe count of nodes i mean by counting the main nodes, those nodes with + or -, Is it possible to do so? How do i do it? The examples i read online only give me the solution for displaying the whole tree and not part of a tree.
Welcome to the Ranch Pamela, we are happy to have you here
I have read several examples from other forums and tried but to no avail.
What problem did you run into when you tried it?
As you probably know, the JTree is just the "view" and is not aware of the data at all. All the data is encapsulated inside the TreeModel. If you carefully go through the API for the TreeModel, you will find lots of convenient methods like getChildCount() and getChild() etc. If you haven't done so already, please do take out time to read this.