Using the controlP5 library, I’m having trouble.
I get this error message:
Aug 10, 2019 7:53:24 AM controlP5.ControlBroadcaster printMethodError
SEVERE: An error occured while forwarding a Controller event, please check your code at controlEvent
java.lang.reflect.InvocationTargetException
With this code:
import controlP5.*;
import processing.net.*;
ControlP5 cp5;
String textoBusqueda = "";
Client cliente;
void setup() {
size(600, 100);
background(51);
cp5 = new ControlP5(this);
cp5.addTextfield("en que pensas?")
.setPosition(150, 30)
.setSize(300,30)
.setFocus(true);
cliente = new Client(this, "127.0.0.1", 8085);
}
void draw() {
background(0);
}
void controlEvent(ControlEvent theEvent) {
textoBusqueda=cp5.get(Textfield.class,"input").getText();
if(theEvent.isAssignableFrom(Textfield.class)) {
if(textoBusqueda != "" && key==ENTER){
cliente.write(textoBusqueda); // codigo para envio datos al servidor
textoBusqueda = "";
}
}
}