TreePath makeTreePath ( TreeNode node ) { ArrayList < TreeNode > path = new ArrayList <> ( ) ; path . add ( node ) ; TreeNode parent = node . getParent ( ) ; while ( parent != null ) { path . add ( 0 , parent ) ; parent = parent . getParent ( ) ; } Object [ ] paths = path . toArray ( ) ; return new TreePath ( paths ) ; }
Create the TreePath corresponding to the given TreeNode .