From the comparison of ours and Sun's implementation behavior, the root
node of the tree must be expanded when it first appears (other nodes
must be collapsed). This path forces to show the JTree root node
expanded as it first appears.
2006-01-27 Audrius Meskauskas <[EMAIL PROTECTED]>
* javax/swing/JTree.java (constructor): Put EXPANDED for the root node
into nodeStates.
Index: JTree.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/JTree.java,v
retrieving revision 1.55
diff -u -r1.55 JTree.java
--- JTree.java 27 Jan 2006 10:10:00 -0000 1.55
+++ JTree.java 27 Jan 2006 20:59:21 -0000
@@ -1482,6 +1482,9 @@
setModel(model);
setSelectionModel(new EmptySelectionModel());
selectionModel.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
+
+ // The root node appears expanded by default.
+ nodeStates.put(new TreePath(model.getRoot()), EXPANDED);
}
/**