开发者

Need to show a tree-like structure that can be dynamically (and infinitely) added to (java)?

开发者 https://www.devze.com 2022-12-22 10:55 出处:网络
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 dynam

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号