Strange behaviour of JTree
Hi,I`m working on Swing GUIs. In most of them I saw a interesting thing (usually on SUN): the nodes of JTree component displayed with huge distance or sometimes up on themselves. Have you ever seen such behavior or I do something wrong?
[250 byte] By [
onenita] at [2007-10-3 4:52:24]

In first case (huge distance):
the tree should be like this:
root
|_node1
|_node2
but what I see e.g.:
root
|_node1
|
|
|
|
|
|
|
|
|
|
|
|
|
|_node2
I cannot represent the other case here, because the root and the node1 and the node2 strings are on top of each other (overwritten)
I saw such errors with JTree, but found no reasonable source for the problem :-\Looks like some problems with JTree L&F in Java.I noticed only it happens more frequently, when application is busy, especially another thread is doing hard work while JTree is reloading etc
It would be a solution for me if there is a bug report about this problem.I checked the bug reports but there is no one mentioned such problemor just I cannot find it. What should I do?
What is the number of bugreport?
I didn`t find such bug report as I mentioned above, but it does not mean that it does not exist. So I also would like to know the bug report number:)
Before I write a bug report I would like to make sure of that it is a JTree problem. Which java version did you see such behaviour with?
Java 5.0 latest version on both Mac OS X and Windows platforms
The bug report is done. But I cannot write you its number yet.They wrote that it takes three weeks.
I know. Ok. Will wait :-)
OK, thanks for your help:)
I've noticed the same behaviour. I started to notice the problem when I started to use animated gif on the jtree. It seems to be related to the icon refresh process performed by NodeImageObserver.
I haven`t any animated gif in the JTree, just simple gif pics.I`ve not managed to figure out what causes exactly this behaviour.And I have no answer to the bug report yet.
In my case, I used to have a method to refresh the Jtree:
public void refreshTree() {
//saveExpansionState();
//((DefaultTreeModel )jTree.getModel()).nodeStructureChanged((TreeNode)topNode);
//mapPanel.repaint();
//loadExpansionState();
////There seems to be a bug in the tree... Changing the panel width seems to fix...
//int currentWidth = jSplitPane1.getDividerLocation();
//jSplitPane1.setDividerLocation(currentWidth + 5);
//jSplitPane1.setDividerLocation(currentWidth);
}
After removing this method, I have bot noticed the problem again.
Interesting. Can you show methods saveExpansionState and loadExpansionState?And why code is commented out?jSplitPane1 - it is panel, which contains tree, right?
Tree weeks.... obviously passed more than 3 week but there`s no answer. Does anybody know that how i can ask about the bug reports? I would need a mail address....