We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I've made a GUI using controlP5 in Processing 2.0 and I have a bang set to call a method from another class whenever the bang is pressed. The method gets called and executes fine, but I still get this error message:
SEVERE: An error occured while forwarding a Controller event, please check your code at controlEvent
java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at controlP5.ControlBroadcaster.invokeMethod(Unknown Source)
at controlP5.ControlBroadcaster.broadcast(Unknown Source)
at controlP5.Controller.broadcast(Unknown Source)
at controlP5.Toggle.setState(Unknown Source)
at controlP5.Toggle.mousePressed(Unknown Source)
at controlP5.Controller.setMousePressed(Unknown Source)
at controlP5.ControllerGroup.setMousePressed(Unknown Source)
at controlP5.ControlWindow.mousePressedEvent(Unknown Source)
at controlP5.ControlWindow.mouseEvent(Unknown Source)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at processing.core.PApplet$RegisteredMethods.handle(PApplet.java:1236)
at processing.core.PApplet.handleMethods(PApplet.java:1431)
at processing.core.PApplet.handleMouseEvent(PApplet.java:2826)
at processing.core.PApplet.dequeueEvents(PApplet.java:2725)
at processing.core.PApplet.handleDraw(PApplet.java:2397)
at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:240)
at processing.core.PApplet.run(PApplet.java:2256)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
at Diatom_2_0_2$Diatom.mask(Diatom_2_0_2.java:4193)
at Diatom_2_0_2$ControlFrame.controlEvent(Diatom_2_0_2.java:8482)
... 23 more
Do I need to register a method somewhere? I don't understand what is happening theory-wise. I think it has to do with classes not being able to "see" each other, giving up control and not returning control back to the ControlP5 controller after the method is called. That sort of thing. If someone could break down what this SEVERE error is for me I'd greatly appreciate it.
Also there's a lot of code in this program, so I don't know really what else to post besides this error message and a description of what I'm trying to do.
Answers
"Caused by: java.lang.NullPointerException"
You should start by investigating this one. If the PDE doesn't highlight a line in your code, you will have to export the project to get the .java file and to be able to go to line 4193.