hi , we have a requirement to get grand parent,parent and child nodes display in treemodel.At the moment we have the parent ,child display of Tree Model .Could you please advise what need to be done to get this hierarchy

-Grand Parent
 - Parent
      -children

   Thanks in advance for your help ,
   Sree

You can call JTree's expandPath(TreePath path) or expandRow(int row) or the corresponding collapse methods to control which nodes will have their child nodes diplayed.

  • read Oracle tutorial How to use Trees, there is (incl. you issue) quite everything described and correctly

  • TreeModel only to store value for JTree's view

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.