From 5b84be227af63e4a0dd0d1d2820a541bbcc237e2 Mon Sep 17 00:00:00 2001 From: Mayank Sharma Date: Sat, 29 Mar 2014 16:40:12 +0530 Subject: [PATCH 1/2] end application when TestChooser dialog is closed added a WindowListener in the constructor that overrides the windowsClosing method to dispose the TestChooser dialog. code tested with positive result for issue#85. --- jme3-examples/src/main/java/jme3test/TestChooser.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/jme3-examples/src/main/java/jme3test/TestChooser.java b/jme3-examples/src/main/java/jme3test/TestChooser.java index b72ab725a..043c3e6d5 100644 --- a/jme3-examples/src/main/java/jme3test/TestChooser.java +++ b/jme3-examples/src/main/java/jme3test/TestChooser.java @@ -84,6 +84,16 @@ public class TestChooser extends JDialog { */ public TestChooser() throws HeadlessException { super((JFrame) null, "TestChooser"); + /** This listener ends application when window is closed (x button on top right corner of test chooser). + * @see issue#85 https://github.com/jMonkeyEngine/jmonkeyengine/issues/85 + */ + addWindowListener(new WindowAdapter(){ + @Override + public void windowClosing(WindowEvent e) + { + dispose(); + } + }); } /** From 4c320f686dbef4a6eba8bc5de201cf86c5f2d6ac Mon Sep 17 00:00:00 2001 From: Mayank Sharma Date: Mon, 31 Mar 2014 16:15:54 +0530 Subject: [PATCH 2/2] issue#85 short approach - setDefaultCloseOperation --- jme3-examples/src/main/java/jme3test/TestChooser.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/jme3-examples/src/main/java/jme3test/TestChooser.java b/jme3-examples/src/main/java/jme3test/TestChooser.java index 043c3e6d5..a2251945e 100644 --- a/jme3-examples/src/main/java/jme3test/TestChooser.java +++ b/jme3-examples/src/main/java/jme3test/TestChooser.java @@ -87,13 +87,7 @@ public class TestChooser extends JDialog { /** This listener ends application when window is closed (x button on top right corner of test chooser). * @see issue#85 https://github.com/jMonkeyEngine/jmonkeyengine/issues/85 */ - addWindowListener(new WindowAdapter(){ - @Override - public void windowClosing(WindowEvent e) - { - dispose(); - } - }); + setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); } /**