Add window listener to main frame. master
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 27 Jan 2009 23:56:43 +0000 (00:56 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 27 Jan 2009 23:56:43 +0000 (00:56 +0100)
src/net/pterodactylus/jkeytool/gui/swing/SwingInterface.java

index 165a6d6..7e3e300 100644 (file)
@@ -21,6 +21,8 @@ package net.pterodactylus.jkeytool.gui.swing;
 
 import java.awt.BorderLayout;
 import java.awt.event.ActionEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
 import java.io.File;
 import java.security.KeyStore;
 import java.util.HashMap;
@@ -137,6 +139,17 @@ public class SwingInterface implements Interface {
                mainFrame.getContentPane().add(createCenterPanel(), BorderLayout.CENTER);
                mainFrame.getContentPane().add(statusBar, BorderLayout.PAGE_END);
                mainFrame.pack();
+               mainFrame.addWindowListener(new WindowAdapter() {
+
+                       /**
+                        * {@inheritDoc}
+                        */
+                       @Override
+                       @SuppressWarnings("synthetic-access")
+                       public void windowClosing(WindowEvent windowEvent) {
+                               quit();
+                       }
+               });
        }
 
        /**