Proposed fix for issue#85 : end demo app when window is closed

Hi, this is the easiest bug fix i guess. Anyways, i have modified the constructor of the TestChooser(jme3test.TestChooser) to include a window listener and dispose the instance when the x button on the top right corner of the dialog is clicked. Here’s the modified constructor :

public TestChooser() throws HeadlessException {
super((JFrame) null, “TestChooser”);
/** This listener ends application when window is closed (x button on top right).
* @see issue#85 Demo application does not end when the window is closed. · Issue #85 · jMonkeyEngine/jmonkeyengine · GitHub
*/
addWindowListener(new WindowAdapter(){
@Override
public void windowClosing(WindowEvent e)
{
dispose();
}
});
}

The code works fine now. Can i send the pull request?
Code comparison can be seen here :https://github.com/maany/jmonkeyengine/compare/issue%2385

3 Likes

You never have to ask for permission to submit a pull request, that’s the beauty of pull requests :wink: So yeah, if you hurry you’ll get to send the first ever pull request for jMonkeyEngine! :smiley:

3 Likes

Or maybe…

setDefaultCloseOperation(DISPOSE_ON_CLOSE);

Submitting pull requests is fine but things should still be posted here like he did.

1 Like

@pspeed : thanks! that’s definitely a better approach !
@erlend_sh : will keep that in mind. I just sent the pull request and hope i’m not late :slight_smile: .