瀏覽代碼

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.
Mayank Sharma 11 年之前
父節點
當前提交
5b84be227a
共有 1 個文件被更改,包括 10 次插入0 次删除
  1. 10 0
      jme3-examples/src/main/java/jme3test/TestChooser.java

+ 10 - 0
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();
+            }
+        });
     }
 
     /**