[SOLVED] Catch Window Closing event

Hello,
can anyone tell me how I can catch the event when the user is closing/stopping the game by pushing the “x” in the top right corner of the program window?
I want to use this to make a clean System.exit(0); when the program finishes.

You can probably override the destroy() method on SimpleApplication, something like this:

    @Override
    public void destroy() {
        //Do something before exit
        super.destroy();
        //Do something after exit
    }
3 Likes

Works perfectly! Thank you very much!

3 Likes