How can I find the parent of a leaf in a JTree?

Sandip Chitale

The nodes of a JTree implement the javax.swing.tree.TreeNode interafce. There is a method to the parent in that interface i.e.


Details are here -

[FAQ Manager Note] This only applies when you're using a TreeModel that uses TreeNodes. This is the case of the default TreeModel used by JTree. If you define or use a custom TreeModel that doesn't use TreeNodes as its nodes, you will need to supply another method to find the parent node.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact