绘制列表时出现Java错误

时间:2012-01-20 18:32:02

标签: java swing exception

我在重新绘制对象列表时遇到异常。我无法找到此错误发生的位置,因为我看不到对我的应用程序文件的引用。

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)

2 个答案:

答案 0 :(得分:1)

there are two issues

1)绘制存在的界限的DirtyRegions

2)比Native OS的延迟更快,f.e。在Win OS(cca)上更新超过30毫秒

如果存在小问题,你是否实现了Custom Look and Feels的某些内容?

请使用在SSCCE表单

中生成RepaintManager异常的代码编辑您的帖子

答案 1 :(得分:1)

如果您正在更改另一个线程中的节点,则线程并发可能是您的问题。如果这是您的问题,使用SwingUtilities.invokeLater操作树节点将确保将在swing线程上对可见节点进行任何更改。