Catch the Exit Event

I would like to catch the exit event coming from the Button which is on the top right of the window (I am working with BaseGame)

Has somebody an idea?



I would like to have the same behaviors as a JFrame for "BaseGame" or maybe for "AbstractGame".

Something like a "JME" JFrame in order to catch the Window Events and to set the icon but i did not find how to do it…


If you mean the x to close the frame then

Add this in the constructor of the frame. call dispose or youre own custom method

addWindowListener(new WindowAdapter() {

                public void windowClosing(WindowEvent e) {




Except that it's not a JFrame… it's a native window.

Please add an RFE (request for enhancement) to jME's issue tracker.

Does LWJGL support this and it's just not added to jME?


You are true : it seems to be part of the LWJGL package.

There is a method "createDisplayImplementation" in the class "org.lwjgl.opengl.Display" which creates a "DisplayImplementation" Interface with several methods like

setTitle() or isCloseRequested() and setIcon().

org.lwjgl.opengl.Display implements these methods but not com.jme.system.DisplaySystem and com.jme.system.lwjgl.LWJGLDisplaySystem

DisplaySystem and LWJGLDisplaySystemboth only implement setTitle()

I am not sure about the goal of isCloseRequested() but setIcon() should be at least integrated.

Your comments?


Like I said… RFE :slight_smile:



In ripping out all the JFrame implemetation to convert to JMEDesktop, have come into the same issue.

The intention is to add a jButton to a JMEDesktop to close the app, the event can then be captured in the actionperformed method of the button

Was this rfe actioned ??? or is it still waiting, had a look but couldnt find…

Notice there is a BaseHeadlessApp class which calls the LWJGLDisplaySystem createHeadlessWindow, this however required the keyboard to be created before the call to initHeadlessDisplay.

Tried to make the keyboard using Keyboard.create() but hit catch 22 as it wouldnt create the keyboard until the display was created

Perplexed and bermused ???