OSDN Git Service

Ctrl+Qでの終了処理実装
authoryukihane <yukihane.feather@gmail.com>
Mon, 5 Sep 2011 11:17:34 +0000 (20:17 +0900)
committeryukihane <yukihane.feather@gmail.com>
Fri, 9 Sep 2011 11:41:52 +0000 (20:41 +0900)
frontend/src/yukihane/inqubus/gui/MainFrame.java

index 5f70895..5af97d3 100644 (file)
@@ -22,7 +22,6 @@ import java.awt.event.WindowEvent;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 import java.io.File;
-import java.io.FilenameFilter;
 import java.io.IOException;
 import java.net.URL;
 import java.nio.file.FileSystem;
@@ -724,13 +723,14 @@ public class MainFrame extends JFrame {
 
         final JMenuItem itExit = new JMenuItem("終了(X)", KeyEvent.VK_X);
         itExit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, ActionEvent.CTRL_MASK));
-        itExit.addActionListener(new ActionListener() {
+        final ActionListener exitActionListener = new ActionListener() {
 
             @Override
             public void actionPerformed(ActionEvent e) {
-                throw new UnsupportedOperationException("Not supported yet.");
+                processWindowEvent(new WindowEvent(MainFrame.this, WindowEvent.WINDOW_CLOSING));
             }
-        });
+        };
+        itExit.addActionListener(exitActionListener);
         mnFile.add(itExit);
 
         final JMenu mnTool = new JMenu("ツール(T)");