Listen for return key
authoramwaterhouse <Andrew Waterhouse>
Mon, 11 Jul 2005 14:32:47 +0000 (14:32 +0000)
committeramwaterhouse <Andrew Waterhouse>
Mon, 11 Jul 2005 14:32:47 +0000 (14:32 +0000)
src/jalview/gui/Finder.java
src/jalview/jbgui/GFinder.java

index 1aceb80..5f683cb 100755 (executable)
@@ -87,15 +87,6 @@ public class Finder extends GFinder
             });\r
     }\r
 \r
-    /**\r
-     * DOCUMENT ME!\r
-     *\r
-     * @param e DOCUMENT ME!\r
-     */\r
-    public void textfield_actionPerformed(ActionEvent e)\r
-    {\r
-        doSearch(false);\r
-    }\r
 \r
     /**\r
      * DOCUMENT ME!\r
@@ -189,7 +180,7 @@ public class Finder extends GFinder
     {\r
         createNewGroup.setEnabled(false);\r
 \r
-        String searchString = textfield.getText().toUpperCase();\r
+        String searchString = textfield.getText().toUpperCase().trim();\r
 \r
         com.stevesoft.pat.Regex regex = new com.stevesoft.pat.Regex(searchString);\r
 \r
index 0f9f0d4..5143e74 100755 (executable)
@@ -104,6 +104,12 @@ public class GFinder
         textfield_caretUpdate(e);\r
       }\r
     });\r
+    textfield.addKeyListener(new java.awt.event.KeyAdapter() {\r
+        public void keyPressed(KeyEvent e) {\r
+            textfield_keyPressed(e);\r
+        }\r
+    });\r
+\r
     borderLayout1.setHgap(5);\r
     borderLayout1.setVgap(5);\r
     jPanel4.setLayout(borderLayout2);\r
@@ -131,12 +137,13 @@ public class GFinder
   {\r
   }\r
 \r
-  protected void textfield_actionPerformed(ActionEvent e)\r
-  {\r
-  }\r
 \r
-  void textfield_keyTyped(KeyEvent e)\r
+  protected void textfield_keyPressed(KeyEvent e)\r
   {\r
+    if(e.getKeyCode()==KeyEvent.VK_ENTER)\r
+    {\r
+      findNext_actionPerformed(null);\r
+    }\r
     findNext.setEnabled(true);\r
   }\r
 \r