We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm trying to send a message (string) to a client after having pressed the button of a form.
String figure0;
void setup(){
cp5 = new ControlP5(this);
cp5.addTextfield("input0").setPosition(x,y).setSize(125,20).setFocus(false).setColor(color(255,0,0)).setAutoClear(false);
cp5.addBang("Submit").setPosition(750, 100).setSize(80, 40);
}
void Submit() {
figure0 = cp5.get(Textfield.class,"input0").getText();
sendAnswer();
}
void sendAnswers(){
OscMessage ansMessage = new OscMessage("/answer");
ansMessage.add(figure0);
oscP5agent1.send(ansMessage, myMaster);
}
***the mymaster****
String prima;
void oscEvent2(OscMessage theOscMessage) {
String w = theOscMessage.addrPattern();
if (w.equals("/answer")) {
String prima=""+theOscMessage.arguments()[0];
};
This is the error message I have got. I tried to get through this problem but I can't understand the motivation. Advices? Thanks a lot!
controlP5.ControlBroadcaster printMethodError
GRAVE: An error occured while forwarding a Controller event, please check your code at Submit
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at controlP5.ControlBroadcaster.invokeMethod(Unknown Source)
at controlP5.ControlBroadcaster.callTarget(Unknown Source)
at controlP5.ControlBroadcaster.broadcast(Unknown Source)
at controlP5.Controller.broadcast(Unknown Source)
at controlP5.Bang.setValue(Unknown Source)
at controlP5.Bang.update(Unknown Source)
at controlP5.Bang.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:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at processing.core.PApplet$RegisteredMethods.handle(PApplet.java:848)
at processing.core.PApplet.handleMouseEvent(PApplet.java:1794)
at processing.core.PApplet.dequeueMouseEvents(PApplet.java:1748)
at processing.core.PApplet.handleDraw(PApplet.java:1642)
at processing.core.PApplet.run(PApplet.java:1530)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.NullPointerException
at agent1.Submit(agent1.java:385)
... 24 more