ControlP5 problem
in
Contributed Library Questions
•
2 years ago
Using the controlP5 library, I'm having trouble. The sliders work alone, as do the radio buttons; But I can't get them to play together: I get this error message....
Jan 19, 2011 11:34:34 PM controlP5.ControlBroadcaster printMethodError
SEVERE: An error occured while forwarding a Controller value
to a method in your program. Please check your code for any
possible errors that might occur in this method .
e.g. check for casting errors, possible nullpointers, array overflows ... .
method: controlEvent
exception: java.lang.reflect.InvocationTargetException
From this code...
void drawGUI(){
controlP5 = new ControlP5(this);
controlP5.addSlider("turnup",-5.0,5.0,0,10,140,10,200);//.setId(2);
Slider s1 = (Slider)controlP5.controller("turnup");
s1.setSliderMode(Slider.FLEXIBLE);
controlP5.addSlider("turnside",-5.0,5.0,0,30,110,200,10);//.setId(3);
Slider s2 = (Slider)controlP5.controller("turnside");
s2.setSliderMode(Slider.FLEXIBLE);
controlP5.addSlider("linewidth",3.0,10.0,6.0,260,20,50,10);//.setId(4);
Slider s3 = (Slider)controlP5.controller("linewidth");
s3.setSliderMode(Slider.FLEXIBLE);
r = controlP5.addRadioButton("radioButton",260,35);
r.setColorForeground(color(120));
r.setColorActive(color(255,0,0));
r.setColorLabel(color(255));
r.setItemsPerRow(3);
r.setSpacingColumn(40);
addToRadioButton(r,"Black",1);
addToRadioButton(r,"Gray",2);
addToRadioButton(r,"Erase",3);
addToRadioButton(r,"Lt_Gray",4);
addToRadioButton(r,"Dk_Gray",5);
}
void addToRadioButton(RadioButton theRadioButton, String theName, int theValue ) {
Toggle t = theRadioButton.addItem(theName,theValue);
t.captionLabel().setColorBackground(color(80));
t.captionLabel().style().movePadding(2,0,-1,2);
t.captionLabel().style().moveMargin(-2,0,0,-3);
t.captionLabel().style().backgroundWidth = 36;
}
void controlEvent(ControlEvent theEvent) {
for(int i=0;i<theEvent.arrayValue().length;i++) {
print(int(theEvent.group().arrayValue()[i]));
}
println("\t "+theEvent.value());
}
Jan 19, 2011 11:34:34 PM controlP5.ControlBroadcaster printMethodError
SEVERE: An error occured while forwarding a Controller value
to a method in your program. Please check your code for any
possible errors that might occur in this method .
e.g. check for casting errors, possible nullpointers, array overflows ... .
method: controlEvent
exception: java.lang.reflect.InvocationTargetException
From this code...
void drawGUI(){
controlP5 = new ControlP5(this);
controlP5.addSlider("turnup",-5.0,5.0,0,10,140,10,200);//.setId(2);
Slider s1 = (Slider)controlP5.controller("turnup");
s1.setSliderMode(Slider.FLEXIBLE);
controlP5.addSlider("turnside",-5.0,5.0,0,30,110,200,10);//.setId(3);
Slider s2 = (Slider)controlP5.controller("turnside");
s2.setSliderMode(Slider.FLEXIBLE);
controlP5.addSlider("linewidth",3.0,10.0,6.0,260,20,50,10);//.setId(4);
Slider s3 = (Slider)controlP5.controller("linewidth");
s3.setSliderMode(Slider.FLEXIBLE);
r = controlP5.addRadioButton("radioButton",260,35);
r.setColorForeground(color(120));
r.setColorActive(color(255,0,0));
r.setColorLabel(color(255));
r.setItemsPerRow(3);
r.setSpacingColumn(40);
addToRadioButton(r,"Black",1);
addToRadioButton(r,"Gray",2);
addToRadioButton(r,"Erase",3);
addToRadioButton(r,"Lt_Gray",4);
addToRadioButton(r,"Dk_Gray",5);
}
void addToRadioButton(RadioButton theRadioButton, String theName, int theValue ) {
Toggle t = theRadioButton.addItem(theName,theValue);
t.captionLabel().setColorBackground(color(80));
t.captionLabel().style().movePadding(2,0,-1,2);
t.captionLabel().style().moveMargin(-2,0,0,-3);
t.captionLabel().style().backgroundWidth = 36;
}
void controlEvent(ControlEvent theEvent) {
for(int i=0;i<theEvent.arrayValue().length;i++) {
print(int(theEvent.group().arrayValue()[i]));
}
println("\t "+theEvent.value());
}
1