File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Exception in expanding the tree Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Exception in expanding the tree" Watch "Exception in expanding the tree" New topic

Exception in expanding the tree

Amit M Tank
Ranch Hand

Joined: Mar 28, 2004
Posts: 257
I got this esception when I was updating the node of the JTree. I am calling the valueForPathChanged(TreePath,Object).

java.lang.ArrayIndexOutOfBoundsException: 3 >= 3
at java.util.Vector.removeElementAt(
at javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.collapse(Var
at javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.collapse(Var
at javax.swing.tree.VariableHeightLayoutCache.setExpandedState(VariableH
at javax.swing.plaf.basic.BasicTreeUI$TreeExpansionHandler.treeCollapsed
at javax.swing.JTree.fireTreeCollapsed(
at javax.swing.JTree.setExpandedState(
at javax.swing.JTree.collapsePath(
at javax.swing.plaf.basic.BasicTreeUI.toggleExpandState(
at javax.swing.plaf.basic.BasicTreeUI.selectPathForEvent(BasicTreeUI.jav
at javax.swing.plaf.basic.BasicTreeUI$MouseHandler.handleSelection(Basic
at javax.swing.plaf.basic.BasicTreeUI$MouseHandler.mousePressed(BasicTre
at java.awt.AWTEventMulticaster.mousePressed(
at java.awt.AWTEventMulticaster.mousePressed(
at java.awt.AWTEventMulticaster.mousePressed(
at java.awt.Component.processMouseEvent(
at java.awt.Component.processEvent(
at java.awt.Container.processEvent(
at java.awt.Component.dispatchEventImpl(
at java.awt.Container.dispatchEventImpl(
at java.awt.Component.dispatchEvent(
at java.awt.LightweightDispatcher.retargetMouseEvent(
at java.awt.LightweightDispatcher.processMouseEvent(

at java.awt.LightweightDispatcher.dispatchEvent(
at java.awt.Container.dispatchEventImpl(
at java.awt.Window.dispatchEventImpl(
at java.awt.Component.dispatchEvent(
at java.awt.EventQueue.dispatchEvent(
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
at java.awt.EventDispatchThread.pumpEvents(

at java.awt.EventDispatchThread.pumpEvents(


Amit Tank
Linked In
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

Are you using any custom models, etc. for the tree? The stack trace doesn't tell much about what the actual problem might be... it looks like it is trying to expand node "3" and only nodes 0-2 exist. Not sure where the extra value is coming from though...

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
It is sorta covered in the JavaRanch Style Guide.
subject: Exception in expanding the tree
It's not a secret anymore!