close a second window?
in
Programming Questions
•
1 year ago
I'm building a small desktop application in Processing. I needed a second window to show a static image.
Now I want to close that second window from the original applet… I created a method calling exit() that causes the whole application to exit. I tried dispose() that gives me a nullpointexception… How can I close that window without closing the whole application?
I'm using this code I found on the old Processing forum:
Now I want to close that second window from the original applet… I created a method calling exit() that causes the whole application to exit. I tried dispose() that gives me a nullpointexception… How can I close that window without closing the whole application?
I'm using this code I found on the old Processing forum:
- PFrame f;
secondApplet s;
void setup() {
size(320, 240);
PFrame f = new PFrame();
}
void draw() {
background(255,0,0);
fill(255);
rect(10,10,frameCount%100,10);
s.background(0, 0, 255);
s.fill(100);
s.rect(10,20,frameCount%120,10);
s.redraw();
}
public class PFrame extends Frame {
public PFrame() {
setBounds(100,100,400,300);
s = new secondApplet();
add(s);
s.init();
show();
}
}
public class secondApplet extends PApplet {
public void setup() {
size(400, 300);
noLoop();
}
public void draw() {
}
}
1