Forums Register Login

JTree problem (Pushing MVC?)

+Pie Number of slices to send: Send
We have some data that, after long debate in our group, we have
decided to represent using a JTree (i.e. this choice is a hard
constraint on further design).
The nodes of this tree fall into disjoint sets, each set consisting of
up to about 10 elements. For any node in the tree, the other nodes
that belong to the same set can be dispersed widely all over the tree.
The problem is to modify the functionality of JTree so that
selecting/deselecting one node automatically selects/deselects all the
nodes in the same set.
What's the best way to modify this behavior? Where does the code
responsible for highlighting selected nodes reside?
Thanks,
KJ
+Pie Number of slices to send: Send
Hi,
I have a similar issue where if a user double clicks on a child node and the UserObject indicates it is of a cetain type (i.e. GOTO type node), then the user "jumps" to the node indicated and expands it accordingly. Extended one step further, if the user right clicks and selects the popup menutiem, "Show cross references", the tree automatically displays and highlights the selected nodes of this "set" ie xref.
I think based on reading some message threads that a Hashmap method which crossrefs node objects with node string keys might make sense. I resisted the hashmap idea early on in my JTree endeavors only because I figured that the JTree already had node objects and I was safer scanning and searching the JTree than to trust that my hashmap was perfectly identically to the JTree. I am not a hash expert and didn't want two duplicate structures of 1000 nodes (the Jtree and the hashmap). Saying all that, it still doesn't make sense to me to scan and rescan a JTree of 1000 nodes linearly and creating the hash should be super fast. comments?
Peter
But how did the elephant get like that? What did you do? I think all we can do now is read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1138 times.
Similar Threads
Expanding a Specific Node in JTree
Searching a JTree
JTree Porblem ! Pl help!
JTree - Compare Nodes problem
JTree Refresh
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 16:38:49.