JAL-1860 only allow enter key when valid selection are made and the veiew/ok button...
authortcofoegbu <tcnofoegbu@dundee.ac.uk>
Thu, 24 Sep 2015 14:56:25 +0000 (15:56 +0100)
committertcofoegbu <tcnofoegbu@dundee.ac.uk>
Thu, 24 Sep 2015 14:56:25 +0000 (15:56 +0100)
src/jalview/jbgui/GPDBSearchPanel.java
src/jalview/jbgui/GStructureChooser.java

index 7543b53..58ec25e 100644 (file)
@@ -182,7 +182,10 @@ public abstract class GPDBSearchPanel extends JPanel
           btn_back_ActionPerformed();
           break;
         case KeyEvent.VK_ENTER: // enter key
-          btn_ok_ActionPerformed();
+          if (btn_ok.isEnabled())
+          {
+            btn_ok_ActionPerformed();
+          }
           break;
         case KeyEvent.VK_TAB: // tab key
           btn_back.requestFocus();
index 802cc0d..73a5615 100644 (file)
@@ -235,10 +235,13 @@ public abstract class GStructureChooser extends JPanel implements
           mainFrame.dispose();
           break;
         case KeyEvent.VK_ENTER: // enter key
-          ok_ActionPerformed();
+          if (btn_view.isEnabled())
+          {
+            ok_ActionPerformed();
+          }
           break;
         case KeyEvent.VK_TAB: // tab key
-          btn_cancel.requestFocus();
+          btn_view.requestFocus();
         default:
           return;
         }
@@ -270,7 +273,10 @@ public abstract class GStructureChooser extends JPanel implements
           mainFrame.dispose();
           break;
         case KeyEvent.VK_ENTER: // enter key
-          ok_ActionPerformed();
+          if (btn_view.isEnabled())
+          {
+            ok_ActionPerformed();
+          }
           break;
         case KeyEvent.VK_TAB: // tab key
           btn_cancel.requestFocus();