From a8bb0960ee2534ea27fd24586fdc0fb9a9a9715e Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Thu, 10 Feb 2005 17:52:53 +0000 Subject: [PATCH] Key listener works!! --- src/jalview/gui/AlignmentPanel.java | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 775e954..96b1e36 100755 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -43,12 +43,13 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene addComponentListener(new ComponentAdapter() { - public void componentResized(ComponentEvent evt) + public void componentResized(ComponentEvent evt) { RefreshPanels(); } }); + hscroll.setFocusable(false); vscroll.setFocusable(false); setFocusable(true); @@ -57,11 +58,30 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene { public void keyPressed(KeyEvent evt) { - if(evt.getKeyCode()==27) + switch(evt.getKeyCode()) { - av.setRubberbandGroup(null); - RefreshPanels(); + case 27: // escape key + av.setRubberbandGroup(null); + RefreshPanels(); + break; + case KeyEvent.VK_X: + alignFrame.cut_actionPerformed(null); + break; + case KeyEvent.VK_C: + alignFrame.copy_actionPerformed(null); + break; + case KeyEvent.VK_V: + alignFrame.paste(true); + break; } + + /* public void doKeyPressed(KeyEvent evt) + { + + if (evt.isControlDown() && evt.getKeyChar() == 'f') + findMenuItem_actionPerformed(null); + }*/ + } }); -- 1.7.10.2