now has key listener
authoramwaterhouse <Andrew Waterhouse>
Tue, 25 Jan 2005 17:06:40 +0000 (17:06 +0000)
committeramwaterhouse <Andrew Waterhouse>
Tue, 25 Jan 2005 17:06:40 +0000 (17:06 +0000)
src/jalview/gui/AlignmentPanel.java

index 3f7a781..9d6467a 100755 (executable)
@@ -20,7 +20,7 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
   ScalePanel scalePanel;\r
   ScorePanel scorePanel;\r
 \r
-  public AlignmentPanel(AlignFrame af, AlignViewport av)\r
+  public AlignmentPanel(AlignFrame af, final AlignViewport av)\r
   {\r
     alignFrame = af;\r
     this.av         = av;\r
@@ -48,6 +48,24 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
           RefreshPanels();\r
      }\r
    });\r
+\r
+   hscroll.setFocusable(false);\r
+   vscroll.setFocusable(false);\r
+   setFocusable(true);\r
+\r
+   addKeyListener(new KeyAdapter()\r
+   {\r
+     public void keyPressed(KeyEvent evt)\r
+     {\r
+       if(evt.getKeyCode()==27)\r
+       {\r
+         av.setRubberbandGroup(null);\r
+         RefreshPanels();\r
+       }\r
+     }\r
+   });\r
+\r
+\r
   }\r
 \r
  public void highlightSearchResults(int [] results)\r
@@ -128,7 +146,7 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
 \r
   public void RefreshPanels()\r
   {\r
-\r
+    requestFocus();\r
     invalidate();\r
     seqPanel.seqCanvas.paintFlag = true;\r
     idPanel.idCanvas.paintFlag = true;\r
@@ -140,6 +158,7 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
 \r
     validate();\r
     repaint();\r
+\r
   }\r
 \r
   int hextent = 0;\r