DefaultMutableTreeNode node = new DefaultMutableTreeNode(root[0]); DefaultMutableTreeNode child; for (int i = 1; i < root.length; i++) { Object nodeSpecifier = root[i]; if (nodeSpecifier instanceof Object[]) child = populate((Object[]) nodeSpecifier); else child = new DefaultMutableTreeNode(nodeSpecifier); node.add(child);
DefaultMutableTreeNode node = new DefaultMutableTreeNode(root[0]); DefaultMutableTreeNode child; for (int i = 1; i < root.length; i++) { Object nodeSpecifier = root[i]; if (nodeSpecifier instanceof Object[] ) child = populate((Object[] ) nodeSpecifier); else child = new DefaultMutableTreeNode(nodeSpecifier); node.add(child); } return(node);
  protected DefaultMutableTreeNode populate(Object[] root) {    DefaultMutableTreeNode node = new DefaultMutableTreeNode(root[0]);    DefaultMutableTreeNode child;    for (int i = 1; i < root.length; i++) {      Object nodeSpecifier = root[i];      if (nodeSpecifier instanceof Object[])  // Ie node with children        child = populate((Object[]) nodeSpecifier);      else        child = new DefaultMutableTreeNode(nodeSpecifier); // Ie Leaf      node.add(child);    }    return (node);  }