Prevent closing all frames

edited July 2015 in How To...

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


    public void draw() {


    public void keyPressed() {
        if (key == '1') {

            Frame f = backFaceCulling.getFrame();

            if (f instanceof JFrame) {
                // why has this no effect?
                println("changed setDefaultCloseOperation");




  • Answer ✓

    I got it. The sketch I loaded was using a 3d renderer. Whatever getFrame() was returning was not an JFrame.

Sign In or Register to comment.