Tree with multiple parents

asked 2013-03-29 20:47:38 +0800

satan87 gravatar image satan87


Anyone has an exemple of a tree which allow multiple parents ?

Something like that A |\ B D E \ / F

thanks Nicolas

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-06-20 09:38:56 +0800

benbai gravatar image benbai
2228 6

Seems it is not supported currently, I tried the code below then the child is under the second (last) parent.

public TreeModel<DefaultTreeNode<String>> getModel () {
    List children = new ArrayList();
    children.add(new DefaultTreeNode("child", (List)null));
    DefaultTreeNode root = new DefaultTreeNode(null,
            new DefaultTreeNode[] {
                new DefaultTreeNode("aaa", children),
                new DefaultTreeNode("bbb", children)
    if (_model == null) {
        _model = new DefaultTreeModel<String>(root);
    return _model;

A node allows multiple parents is more like a graph rather than a tree, maybe you can post a feature request.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

1 follower



Asked: 2013-03-29 20:47:38 +0800

Seen: 21 times

Last updated: Jun 20 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More