From: amwaterhouse Date: Mon, 11 Jul 2005 14:32:47 +0000 (+0000) Subject: Listen for return key X-Git-Tag: Release_2_01~5 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=f5c630601eccc201dd73f34227acf97f59a9168f;p=jalview.git Listen for return key --- diff --git a/src/jalview/gui/Finder.java b/src/jalview/gui/Finder.java index 1aceb80..5f683cb 100755 --- a/src/jalview/gui/Finder.java +++ b/src/jalview/gui/Finder.java @@ -87,15 +87,6 @@ public class Finder extends GFinder }); } - /** - * DOCUMENT ME! - * - * @param e DOCUMENT ME! - */ - public void textfield_actionPerformed(ActionEvent e) - { - doSearch(false); - } /** * DOCUMENT ME! @@ -189,7 +180,7 @@ public class Finder extends GFinder { createNewGroup.setEnabled(false); - String searchString = textfield.getText().toUpperCase(); + String searchString = textfield.getText().toUpperCase().trim(); com.stevesoft.pat.Regex regex = new com.stevesoft.pat.Regex(searchString); diff --git a/src/jalview/jbgui/GFinder.java b/src/jalview/jbgui/GFinder.java index 0f9f0d4..5143e74 100755 --- a/src/jalview/jbgui/GFinder.java +++ b/src/jalview/jbgui/GFinder.java @@ -104,6 +104,12 @@ public class GFinder textfield_caretUpdate(e); } }); + textfield.addKeyListener(new java.awt.event.KeyAdapter() { + public void keyPressed(KeyEvent e) { + textfield_keyPressed(e); + } + }); + borderLayout1.setHgap(5); borderLayout1.setVgap(5); jPanel4.setLayout(borderLayout2); @@ -131,12 +137,13 @@ public class GFinder { } - protected void textfield_actionPerformed(ActionEvent e) - { - } - void textfield_keyTyped(KeyEvent e) + protected void textfield_keyPressed(KeyEvent e) { + if(e.getKeyCode()==KeyEvent.VK_ENTER) + { + findNext_actionPerformed(null); + } findNext.setEnabled(true); }