- setFocusable(true);\r
- addKeyListener(new KeyAdapter()\r
- {\r
- public void keyPressed(KeyEvent evt)\r
- {\r
- switch(evt.getKeyCode())\r
- {\r
- case 27: // escape key\r
- av.setSelectionGroup(null);\r
- repaint();\r
- break;\r
- case KeyEvent.VK_X:\r
- if(evt.isControlDown())\r
- alignFrame.cut_actionPerformed(null);\r
- break;\r
- case KeyEvent.VK_C:\r
- if(evt.isControlDown())\r
- alignFrame.copy_actionPerformed(null);\r
- break;\r
- case KeyEvent.VK_V:\r
- if(evt.isControlDown())\r
- alignFrame.paste(true);\r
- break;\r
- case KeyEvent.VK_A:\r
- if(evt.isControlDown())\r
- alignFrame.selectAllSequenceMenuItem_actionPerformed(null);\r
- break;\r
- case KeyEvent.VK_DOWN:\r
- alignFrame.moveSelectedSequences(false);\r
- break;\r
- case KeyEvent.VK_UP:\r
- alignFrame.moveSelectedSequences(true);\r
- break;\r
- case KeyEvent.VK_F:\r
- if(evt.isControlDown())\r
- alignFrame.findMenuItem_actionPerformed(null);\r
- break;\r
- }\r
- }\r
- });\r
- }\r
-\r
- public void fontChanged()\r
- {\r
- // set idCanvas bufferedImage to null\r
- // to prevent drawing old image\r
- FontMetrics fm = getFontMetrics(av.getFont());\r
-\r
- scalePanelHolder.setPreferredSize(new Dimension(10, av.charHeight+fm.getDescent()));\r
- idSpaceFillerPanel1.setPreferredSize(new Dimension(10, av.charHeight+fm.getDescent()));\r
-\r
- idPanel.idCanvas.gg = null;\r
- annotationPanel.adjustPanelHeight();\r
- Dimension d = calculateIdWidth();\r
- d.setSize(d.width + 4, d.height);\r
- idPanel.idCanvas.setPreferredSize(d);\r
- hscrollFillerPanel.setPreferredSize(d);\r
- repaint();\r
- }\r
-\r
-\r
- Dimension calculateIdWidth()\r
- {\r
- Graphics g = this.getGraphics();\r
- if(g==null)\r
- {\r
- javax.swing.JFrame f = new javax.swing.JFrame();\r
- f.addNotify();\r
- g = f.getGraphics();\r
- }\r