32088b0750c61c52615e2ca80dace76d0c29c671
[debian/jabref.git] / debian / patches / 02_button.dpatch
1 #! /bin/sh /usr/share/dpatch/dpatch-run
2 ## 02_button.dpatch by  <gregor+debian@comodo.priv.at>
3 ##
4 ## All lines beginning with `## DP:' are a description of the patch.
5 ## DP: Make buttons react to 'enter'.
6 ##     Patch by Morten Omholt Alver (upstream author)
7
8 @DPATCH@
9 diff -urNad jabref~/src/java/net/sf/jabref/JabRef.java jabref/src/java/net/sf/jabref/JabRef.java
10 --- jabref~/src/java/net/sf/jabref/JabRef.java  2006-08-10 21:38:43.000000000 +0200
11 +++ jabref/src/java/net/sf/jabref/JabRef.java   2006-09-25 00:30:22.000000000 +0200
12 @@ -654,6 +654,15 @@
13                              UIManager.put("SimpleInternalFrame.activeTitleBackground", GUIGlobals.gradientBlue);
14                              //UIManager.put("TabbedPane.selected", Color.red);
15                          }
16 +
17 +                       if (!Globals.ON_WIN && !Globals.ON_MAC) {
18 +                            // For Linux, add Enter as button click key:
19 +                            UIDefaults def = UIManager.getDefaults();
20 +                            InputMap im = (InputMap)def.get("Button.focusInputMap");
21 +                            im.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), "pressed");
22 +                            im.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, true), "released");
23 +                        }
24 +
25                      } catch (Throwable ex) {
26                          ex.printStackTrace();
27                          System.err.println("Trying to set system default Look&Feel...");