ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/java/installer2/src/net/oni2/aeinstaller/gui/MainWin.java
(Generate patch)

Comparing java/installer2/src/net/oni2/aeinstaller/gui/MainWin.java (file contents):
Revision 863 by alloc, Thu May 9 10:19:55 2013 UTC vs.
Revision 871 by alloc, Mon May 20 09:16:34 2013 UTC

# Line 1 | Line 1
1   package net.oni2.aeinstaller.gui;
2  
3   import java.awt.BorderLayout;
4 + import java.awt.Component;
5   import java.awt.Desktop;
6   import java.awt.GridLayout;
7 + import java.awt.KeyEventDispatcher;
8 + import java.awt.KeyboardFocusManager;
9   import java.awt.Toolkit;
10   import java.awt.datatransfer.Clipboard;
11   import java.awt.datatransfer.StringSelection;
# Line 90 | Line 93 | import org.simplericity.macify.eawt.Appl
93   * @author Christian Illy
94   */
95   public class MainWin extends JFrame implements ApplicationListener,
96 <                ModInstallSelectionListener, ModSelectionListener {
96 >                ModInstallSelectionListener, ModSelectionListener, KeyEventDispatcher {
97          private static final long serialVersionUID = -4027395051382659650L;
98  
99          private ResourceBundle bundle = UTF8ResourceBundleLoader
# Line 180 | Line 183 | public class MainWin extends JFrame impl
183                  tblMods.addModSelectionListener(this);
184                  tblMods.addDownloadSizeListener(this);
185  
186 +                KeyboardFocusManager.getCurrentKeyboardFocusManager()
187 +                                .addKeyEventDispatcher(this);
188 +
189                  setSize(SettingsManager.getInstance().get("win_main_width", 1050),
190                                  SettingsManager.getInstance().get("win_main_height", 600));
191                  setLocationRelativeTo(null);
# Line 571 | Line 577 | public class MainWin extends JFrame impl
577                  });
578          }
579  
574        @SuppressWarnings("unused")
580          private void refreshLocalMods() {
581                  PackageManager.getInstance().updateLocalData();
582                  tblMods.reloadData();
# Line 1012 | Line 1017 | public class MainWin extends JFrame impl
1017                  }
1018          }
1019  
1020 +        private boolean componentBelongsToWindow(Component c) {
1021 +                while (c != null) {
1022 +                        if (c == this)
1023 +                                return true;
1024 +                        c = c.getParent();
1025 +                }
1026 +                return false;
1027 +        }
1028 +
1029 +        @Override
1030 +        public boolean dispatchKeyEvent(KeyEvent e) {
1031 +                if (e.getID() == KeyEvent.KEY_PRESSED) {
1032 +                        switch (e.getKeyCode()) {
1033 +                                case KeyEvent.VK_F5:
1034 +                                        if (componentBelongsToWindow(e.getComponent()))
1035 +                                                refreshLocalMods();
1036 +                                        return true;
1037 +                        }
1038 +                }
1039 +                return false;
1040 +        }
1041 +
1042          @Override
1043          public void handleAbout(ApplicationEvent event) {
1044                  event.setHandled(true);

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)