Exception occurred during event dispatching:
java.lang.ArrayIndexOutOfBoundsException: 6 >= 6
at java.util.Vector.elementAt(Vector.java:417)
at
javax.swing.tree.DefaultMutableTreeNode.getChildAt(DefaultMutableTreeNode.java:231)
at
javax.swing.tree.DefaultTreeModel.getChild(DefaultTreeModel.java:151)
at
javax.swing.tree.FixedHeightLayoutCache$VisibleFHTreeStateNodeEnumeration.nextElement(FixedHeightLayoutCache.java:1485)
at javax.swing.plaf.basic.BasicTreeUI.paint(BasicTreeUI.java:1070)
at javax.swing.plaf.metal.MetalTreeUI.paint(MetalTreeUI.java:139)
at javax.swing.plaf.ComponentUI.update(ComponentUI.java:39)
at javax.swing.JComponent.paintComponent(JComponent.java:398)
at javax.swing.JComponent.paint(JComponent.java:739)
at javax.swing.JComponent.paintChildren(JComponent.java:523)
at javax.swing.JComponent.paint(JComponent.java:748)
at javax.swing.JViewport.paint(JViewport.java:668)
at javax.swing.JComponent.paintWithBuffer(JComponent.java:4393)
at javax.swing.JComponent._paintImmediately(JComponent.java:4336)
at javax.swing.JComponent.paintImmediately(JComponent.java:4187)
at
javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:370)
at
javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:205)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:154)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:331)
at
java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:103)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:84)\
Even if i synchronize access to the treemodel i still have the ....
exception sometime
while (iter.hasNext()) {
JobUnitImpl ju = (JobUnitImpl) iter.next();
JobUnitNode jun = new JobUnitNode(ju, model, JOB_DATA);
//////////////////////////////////////////////////
synchronized (model) {
model.insertNodeInto(jun, this, 0);
}
/////////////////////////////////////////////////
jun.buildChildren();
}
Is somebody can help me
Thanks
ps: sorry for my english , i 'm a poor little frenchy a bit exasperate
by this problem
> Hello
> Is somebody know how to synchronize a DefaultTreeModel and its display
> ???
> I have a dynamic tree which is modify by some threads.
You cannot do that. As Swing's model-inspecting code does not synchro-
nize on the model while inspecting, there is no change to lock it during
modifying, thus assumptions that the code makes (for example that no chil-
dren are added or removed during execution) fail.
You have to perform the actual change in the event-dispatch thread,
using SwingUtitities.invokeLater, for example.
Christian
--
"But 'glory' doesn't mean 'a nice knock-down argument,'" Alice objected.
"When I use a word," Humpty Dumpty said in rather a scornful tone, "it
means just what I choose it to mean -- neither more nor less."
Through the Looking-Glass
Thanks,
Bruno
I suppose you mean start the editing programmatically ?
Have you tried tree.startEditingAtPath(path) ?
Kala