Closing my game in a clean way --Solved


I’m implementing a game with more threads than the ones given by the SimpleApplication.

When I close my main window it seems the game is not really closed. ( In eclipse, the Stp button is still red )

I tried to add a finalize method in which I wnated to stop my opther threads but the game doesn’t step inside.

Which method is called when you cick on the cross button in the upper right corner of the main Window ?

Thanks in advance

You can do this in two ways. You can make your additional threads as daemon (Thread.setDaemon()) this will make Java automatically close them when the main threads are closing.

Another way is to override the destroy() method of Application, make sure you call the super.destroy() method though:



public void destroy(){


// do shutdown stuff here




Perfect, that’s exactly what I needed !