早教吧 育儿知识 作业答案 考试题库 百科 知识分享

Exceptioninthread"AWT-EventQueue-0"java.lang.ArrayIndexOutOfBoundsException:2atorg.jcjava.dwindow.Dwindow.actionPerformed(Dwindow.java:46)atjava.awt.TextField.processActionEvent(UnknownSource)atjava.awt.TextField.processEvent(UnknownSource)a

题目详情
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException:2
at org.jcjava.dwindow.Dwindow.actionPerformed(Dwindow.java:46)
at java.awt.TextField.processActionEvent(Unknown Source)
at java.awt.TextField.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(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)
▼优质解答
答案和解析
数组越界了,你的使用了不可用的索引:
比如:
int[] a = new int[3];
a[3] = 1;
这个就是错了,因为a[3]不存在
你看看你声明的组件的数组是不是也出现了这个情况,比如把
JTextField放在一个数组里,然后越界