We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I want to make a sketch that can open other sketches. So far it goes good but I can't change the behaviour of the sketches that are opened on runtime.
Why has the setDefaultCloseOperation no effect?
(Also, it should be DISPOSE_ON_CLOSE but I'm using DO_NOTHING_ON_CLOSE for testing).
public class AllSketches extends PApplet {
public static void main(String[] args) {
PApplet.main("forMyself.AllSketches", args);
}
P5_BackFaceCulling backFaceCulling;
public void setup() {
// works
((JFrame)getFrame()).setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
}
public void draw() {
}
public void keyPressed() {
if (key == '1') {
println("test");
Frame f = backFaceCulling.getFrame();
if (f instanceof JFrame) {
// why has this no effect?
((JFrame)f).setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
println("changed setDefaultCloseOperation");
}
}
}
}
Answers
I got it. The sketch I loaded was using a 3d renderer. Whatever getFrame() was returning was not an JFrame.