Can Tabs in a program cause Exception In Event Handler ?
in
Contributed Library Questions
•
8 months ago
Hello!
I'm trying to write a big program that loads a Periodic Table from a text file and then ask questions about it. I'm a Chemistry teacher trying to write a program that will help my students get really fast feedback on their homework (and cut down on the time I spend grading. :)
I have a basic version of the program that works. The code is spread across 7 tabs so I'll call it the "7 tabs version". I recently made a small change to it (I'm not sure what it was, it was only a few lines) and started getting a runtime error. To try and debug it I copied all of the files into a new sketch but with all the tabs on 1 page. I'll call this the "1 page version".
Both versions of the program contain identical code, but the "7 tabs version" has it in 7 tabs, and the "1 page version" has it all on 1 page.
I'll summarize what I've found with bullet points:
The runtime error message I get is copied below. The code is really long so I'll avoid posting it here unless people think it will help.
################ EXCEPTION IN EVENT HANDLER ################
An error occured during execution of the eventhandler:
CLASS: Elements_File_Reader_GUI_Interface_6 METHOD: nameEntryButton_click1
Caused by java.lang.ArrayIndexOutOfBoundsException: 0
Elements_File_Reader_GUI_Interface_6.askQuestionB(Elements_File_Reader_GUI_Interface_6.java:303)
Elements_File_Reader_GUI_Interface_6.nameEntryButton_click1(Elements_File_Reader_GUI_Interface_6.java:456)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
g4p_controls.GAbstractControl.fireEvent(Unknown Source)
g4p_controls.GButton.mouseEvent(Unknown Source)
g4p_controls.GWindowInfo.mouseEvent(Unknown Source)
sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
processing.core.PApplet$RegisteredMethods.handle(PApplet.java:1084)
processing.core.PApplet.handleMethods(PApplet.java:1279)
processing.core.PApplet.handleMouseEvent(PApplet.java:2560)
processing.core.PApplet.dequeueEvents(PApplet.java:2463)
processing.core.PApplet.handleDraw(PApplet.java:2153)
processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:193)
processing.core.PApplet.run(PApplet.java:2020)
java.lang.Thread.run(Thread.java:662)
##############################################################
I'm trying to write a big program that loads a Periodic Table from a text file and then ask questions about it. I'm a Chemistry teacher trying to write a program that will help my students get really fast feedback on their homework (and cut down on the time I spend grading. :)
I have a basic version of the program that works. The code is spread across 7 tabs so I'll call it the "7 tabs version". I recently made a small change to it (I'm not sure what it was, it was only a few lines) and started getting a runtime error. To try and debug it I copied all of the files into a new sketch but with all the tabs on 1 page. I'll call this the "1 page version".
Both versions of the program contain identical code, but the "7 tabs version" has it in 7 tabs, and the "1 page version" has it all on 1 page.
I'll summarize what I've found with bullet points:
- The "7 tabs version" gives me a runtime error when it's the only sketch I have open.
- The "1 page version" always works exactly like it should.
- If I have the "7 tabs version" open along with the "1 page version", then the "7 tabs version" will also work!
- If I close "1 page version" and then run the "7 tabs version", the "7 tabs version" will give me the runtime error again
The runtime error message I get is copied below. The code is really long so I'll avoid posting it here unless people think it will help.
################ EXCEPTION IN EVENT HANDLER ################
An error occured during execution of the eventhandler:
CLASS: Elements_File_Reader_GUI_Interface_6 METHOD: nameEntryButton_click1
Caused by java.lang.ArrayIndexOutOfBoundsException: 0
Elements_File_Reader_GUI_Interface_6.askQuestionB(Elements_File_Reader_GUI_Interface_6.java:303)
Elements_File_Reader_GUI_Interface_6.nameEntryButton_click1(Elements_File_Reader_GUI_Interface_6.java:456)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
g4p_controls.GAbstractControl.fireEvent(Unknown Source)
g4p_controls.GButton.mouseEvent(Unknown Source)
g4p_controls.GWindowInfo.mouseEvent(Unknown Source)
sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
processing.core.PApplet$RegisteredMethods.handle(PApplet.java:1084)
processing.core.PApplet.handleMethods(PApplet.java:1279)
processing.core.PApplet.handleMouseEvent(PApplet.java:2560)
processing.core.PApplet.dequeueEvents(PApplet.java:2463)
processing.core.PApplet.handleDraw(PApplet.java:2153)
processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:193)
processing.core.PApplet.run(PApplet.java:2020)
java.lang.Thread.run(Thread.java:662)
##############################################################
1