How do I auto-expand a JTree when setting a new TreeModel?
I have a custom JTree and a custom JModel; I would for the JTree to "auto-expand" when I give it a new model. At the moment, it simply collapse all the nodes to the root. Here is an example: private class CustomTree extends JTree { @Override public boolean isExpanded(TreePath path) { return ((Person) path.getLastPathComponent).hasChildren(); } private class CustomTreeModel extends TreeModel { // ... omitting various implementation details @Override public boolean isLeaf(Object object) { return !((Person) object).hasChildren(); } } Model model = new Model(); Person bob = new Person(); Person al
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.