Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
can';找不到java.lang.ArrayIndexOutOfBoundsException的问题_Java_Debugging_Exception_Exception Handling - Fatal编程技术网

can';找不到java.lang.ArrayIndexOutOfBoundsException的问题

can';找不到java.lang.ArrayIndexOutOfBoundsException的问题,java,debugging,exception,exception-handling,Java,Debugging,Exception,Exception Handling,我的应用程序有问题,有时会在控制台中返回此错误,但我找不到来源(所有未知源)。应用程序似乎在出现此错误后正常工作,但我想了解出现了什么。。。我该怎么办 谢谢你,对不起我的英语 Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 0 at javax.swing.plaf.basic.BasicListUI.updateLayoutState(Unknown Source) at java

我的应用程序有问题,有时会在控制台中返回此错误,但我找不到来源(所有未知源)。应用程序似乎在出现此错误后正常工作,但我想了解出现了什么。。。我该怎么办

谢谢你,对不起我的英语

Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: 0
at javax.swing.plaf.basic.BasicListUI.updateLayoutState(Unknown Source)
at javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(Unknown Source)
at javax.swing.plaf.basic.BasicListUI.getPreferredSize(Unknown Source)
at javax.swing.JComponent.getPreferredSize(Unknown Source)
at javax.swing.ScrollPaneLayout.layoutContainer(Unknown Source)
at java.awt.Container.layout(Unknown Source)
at java.awt.Container.doLayout(Unknown Source)
at java.awt.Container.validateTree(Unknown Source)
at java.awt.Container.validate(Unknown Source)
at javax.swing.RepaintManager.validateInvalidComponents(Unknown Source)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

查看
BasicListUI.updateLayoutState()
的源代码,只有在执行该方法时所显示的列表的大小发生变化时,才会发生这种情况

最可能的原因是您正在从外部修改模型。这是一个严重的问题,因为它可能导致各种奇怪的行为,甚至损坏数据


若要解决这些问题,请在需要从EDT外部操作模型时使用。

这种类型的错误有时是由更新EDT上的GUI组件引起的,此时应在EDT上执行


如果修复任何违反该原则的代码都不能解决问题,我建议您尝试准备一个并将其发布到线程。

是否有导致此异常的原因?您好,在使用SwingUtilities.invokeLater()测试我的应用程序3小时后,我可以说问题已经解决!!!再次非常感谢@Michael Borgwardt