Need to show a tree-like structure that can be dynamically (and infinitely) added to (java)?
I'm looking to build a tree-like s开发者_开发知识库tructure for my Java application. I've tried using libraries such as Prefuse and Jung, but they do not seem to (easily, at least) allow me to dynamically expand the trees based on users' selections.
For example, here is a starting tree:
Branch
Branch
Root -> Branch
Branch
Branch
Now, the user can select any one of these branches to expand. The catch, though, is that the results of clicking a branch needs to be processed at run time. So after clicking the first branch and my processing is done, I would like to update the tree to look like this:
Branch
Branch
Branch -> Branch
Branch
Root -> Branch
Branch
Branch
This can happen an unlimited (available space permitting) number of times.
In my reserach, I've found graphing libraries such as those listed above to be too complex for this (seemingly simple) task. Also, I would like to avoid JTree as it doesn't fit my view of this project.
My ideal solution is some type of custom Tree that gives the look of this Prefuse sample but with the ease of use of a simple tree structure (like JTree).
Any ideas and suggestions are most welcome and appreciated. Thanks for reading.
Have you thought about using a custom rendering for JTree ? Like a specific look'n'feel ? Indeed, JTree is precisely focused on object tree representation.
精彩评论