0

I have been getting following exception while repainting the list of my object. I am unable to find where this error is occuring because I can't see the reference to my application file.

Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 1
    at java.util.Vector.elementAt(Vector.java:341)
    at javax.swing.tree.VariableHeightLayoutCache.updateNodeSizes(VariableHeightLayoutCache.java:908)
    at javax.swing.tree.VariableHeightLayoutCache.getBounds(VariableHeightLayoutCache.java:212)
    at javax.swing.plaf.basic.BasicTreeUI.getPathBounds(BasicTreeUI.java:521)
    at javax.swing.plaf.basic.BasicTreeUI.paint(BasicTreeUI.java:1184)
    at javax.swing.plaf.ComponentUI.update(ComponentUI.java:154)
    at javax.swing.JComponent.paintComponent(JComponent.java:763)
    at javax.swing.JComponent.paint(JComponent.java:1040)
    at javax.swing.JComponent.paintChildren(JComponent.java:873)
    at javax.swing.JComponent.paint(JComponent.java:1049)
    at javax.swing.JViewport.paint(JViewport.java:758)
    at javax.swing.JComponent.paintChildren(JComponent.java:873)
    at javax.swing.JComponent.paint(JComponent.java:1049)
    at javax.swing.JComponent.paintToOffscreen(JComponent.java:5135)
    at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1490)
    at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1421)
    at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:305)
    at javax.swing.RepaintManager.paint(RepaintManager.java:1235)
    at javax.swing.JComponent._paintImmediately(JComponent.java:5083)
    at javax.swing.JComponent.paintImmediately(JComponent.java:4893)
    at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:796)
    at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:724)
    at javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:704)
    at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:136)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:220)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:650)
    at java.awt.EventQueue.access$000(EventQueue.java:95)
    at java.awt.EventQueue$1.run(EventQueue.java:613)
    at java.awt.EventQueue$1.run(EventQueue.java:611)
    at java.security.AccessController.doPrivileged(AccessController.java:224)
    at com.ibm.oti.security.CheckedAccessControlContext.securityCheck(CheckedAccessControlContext.java:30)
    at sun.misc.JavaSecurityAccessWrapper.doIntersectionPrivilege(JavaSecurityAccessWrapper.java:29)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:621)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:280)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:195)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:185)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:180)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:172)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:133)
Mike
  • 1,889
  • 5
  • 26
  • 32

2 Answers2

1

there are two issues

1) painting to the DirtyRegions of out Bounds that exists

2) faster than latency from Native OS, f.e. on Win OS (cca) updates faster than 30miliseconds

minor issue if exist there, did you implements some of Custom Look and Feels ?

please edit your post with code that generated exceptions from RepaintManager in SSCCE form

Community
  • 1
  • 1
mKorbel
  • 109,525
  • 20
  • 134
  • 319
1

If you're changing the nodes in another thread, thread concurrency could be your problem. If this is your problem, using SwingUtilities.invokeLater to manipulate the tree nodes will ensure that any changes to the visible nodes will be made on the swing thread.

Beothorn
  • 1,289
  • 10
  • 19
  • 1
    +1, This would be my guess as well. The poster should read the Swing tutorial on [Concurrency in Swing](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html) to better understand the potential problem. – camickr Jan 20 '12 at 20:33