TreePath (final int row) { TreeNode node = myTreeModelAsList.get(row); final List<TreeNode> path = new ArrayList<>(); while (node != null) { path.add(0, node); node = node.getParent(); } return new TreePath(path.toArray(new TreeNode[0])); }