Key listener works!!
authoramwaterhouse <Andrew Waterhouse>
Thu, 10 Feb 2005 17:52:53 +0000 (17:52 +0000)
committeramwaterhouse <Andrew Waterhouse>
Thu, 10 Feb 2005 17:52:53 +0000 (17:52 +0000)
src/jalview/gui/AlignmentPanel.java

index 775e954..96b1e36 100755 (executable)
@@ -43,12 +43,13 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
 \r
     addComponentListener(new ComponentAdapter()\r
    {\r
-       public void componentResized(ComponentEvent evt)\r
+     public void componentResized(ComponentEvent evt)\r
      {\r
           RefreshPanels();\r
      }\r
    });\r
 \r
+\r
    hscroll.setFocusable(false);\r
    vscroll.setFocusable(false);\r
    setFocusable(true);\r
@@ -57,11 +58,30 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
    {\r
      public void keyPressed(KeyEvent evt)\r
      {\r
-       if(evt.getKeyCode()==27)\r
+       switch(evt.getKeyCode())\r
        {\r
-         av.setRubberbandGroup(null);\r
-         RefreshPanels();\r
+         case 27: // escape key\r
+           av.setRubberbandGroup(null);\r
+           RefreshPanels();\r
+           break;\r
+         case KeyEvent.VK_X:\r
+           alignFrame.cut_actionPerformed(null);\r
+           break;\r
+         case KeyEvent.VK_C:\r
+           alignFrame.copy_actionPerformed(null);\r
+           break;\r
+         case KeyEvent.VK_V:\r
+           alignFrame.paste(true);\r
+           break;\r
        }\r
+\r
+      /* public void doKeyPressed(KeyEvent evt)\r
+       {\r
+\r
+         if (evt.isControlDown() && evt.getKeyChar() == 'f')\r
+           findMenuItem_actionPerformed(null);\r
+       }*/\r
+\r
      }\r
    });\r
 \r