Hello, I am a rusty programmer.. I was wondering if someone would be kind enough to point out my misunderstanding. I am setting up two windows.. one running a temperature graph and one containing the controls. There are three temp stations. Everything was running along smoothly until I tried using the setOn() or setOff() button functions. I think I am misunderstanding something basic about how the ControlP5 library works.
There is a lot of irrelevant code... I think this should be enough to help me...if you so choose.
`
SecondWin sw;
void settings() {
size(1100, 850, JAVA2D);
}
void setup() {
sw = new SecondWin(this, 700, 400); //second Window (Control Panel)
}
void draw() {
}
public class SecondWin extends PApplet { // code for window
int w, h;
PApplet parent;
ControlP5 cp5;
public SecondWin(PApplet _parent, int _w, int _h) {
super();
parent = _parent;
w = _w;
h = _h;
PApplet.runSketch(new String[]{this.getClass().getName()}, this);
}
public void settings() {
size(w, h);
}
public void setup() {
cp5 = new ControlP5(this);
cp5.addButton("VS2")
.setImages(icons[0], icons[0], icons[10])
.updateSize()
.setPosition(10, 10)
.setSwitch(true)
.setId(50)
.plugTo(parent, "VS2");
}
public void draw() {
background(255);
fill(0);
}
public void controlEvent(ControlEvent theEvent) {
if (theEvent.isController()) {
println(((Button)cp5.getController("VS2")).isOn());
// ((Button)cp5.getController("VS2")).setOn(); ########## PROBLEM ######
}
}
}
`
As mentioned, I left out a lot of code. I have been fighting this for a few hours...so a lot of this code I have stolen from online sources and Frankenstein'd here.
As is, it runs with no errors and hitting the VS2 button prints out the proper false and true values. When I un-comment the ((Button)cp5.getController("VS2")).setOn(); and then hit the button, I get a stream of multiple 'trues' printed to console and
java.lang.NoClassDefFoundError: Could not initialize class java.util.logging.LogRecord
at java.util.logging.Logger.log(Logger.java:787)
at java.util.logging.Logger.severe(Logger.java:1463)
at controlP5.ControlBroadcaster.printMethodError(Unknown Source)
at controlP5.ControlBroadcaster.invokeMethod(Unknown Source)
at controlP5.ControlBroadcaster.broadcast(Unknown Source)
at controlP5.Controller.broadcast(Unknown Source)
at controlP5.Button.setValue(Unknown Source)
at controlP5.Button.activate(Unknown Source)
at controlP5.Button.mouseReleased(Unknown Source)
at controlP5.Controller.setMousePressed(Unknown Source)
at controlP5.ControllerGroup.setMousePressed(Unknown Source)
at controlP5.ControlWindow.mouseReleasedEvent(Unknown Source)
at controlP5.ControlWindow.mouseEvent(Unknown Source)
at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at processing.core.PApplet$RegisteredMethods.handle(PApplet.java:1398)
at processing.core.PApplet.handleMethods(PApplet.java:1593)
at processing.core.PApplet.handleMouseEvent(PApplet.java:2680)
at processing.core.PApplet.dequeueEvents(PApplet.java:2603)
at processing.core.PApplet.handleDraw(PApplet.java:2414)
at processing.awt.PSurfaceAWT$12.callDraw(PSurfaceAWT.java:1527)
at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:316)
If it is something really basic I am missing, even throwing me a reference page address would be appreciated.
Thanks!