{\r
ex.printStackTrace();\r
}\r
+\r
this.applet = applet;\r
viewport = new AlignViewport(al, applet);\r
alignPanel = new AlignmentPanel(this, viewport);\r
\r
if(applet!=null)\r
{\r
- String treeFile = applet.getParameter("treeFile");\r
- if (treeFile != null)\r
- {\r
- try\r
- {\r
- jalview.io.NewickFile fin = new jalview.io.NewickFile(applet.\r
- getCodeBase() + treeFile, "URL");\r
- fin.parse();\r
-\r
- if (fin.getTree() != null)\r
- {\r
- TreePanel tp = null;\r
- tp = new TreePanel(viewport, viewport.getAlignment().getSequences(),\r
- fin, "FromFile", applet.getCodeBase() + treeFile);\r
- jalview.bin.JalviewLite.addFrame(tp, treeFile, 600, 500);\r
- addTreeMenuItem(tp, treeFile);\r
- }\r
- }\r
- catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- }\r
- }\r
-\r
String param = applet.getParameter("sortBy");\r
if (param != null)\r
{\r
\r
}\r
\r
+ MyKeyAdapter keyAdapter = new MyKeyAdapter();\r
+ //Some JVMS send keyevents to Top frame or lowest panel,\r
+ //Havent worked out why yet. So add to both this frame and seqCanvas for now\r
+ this.addKeyListener(keyAdapter);\r
+ alignPanel.seqPanel.seqCanvas.addKeyListener(keyAdapter);\r
+ alignPanel.idPanel.idCanvas.addKeyListener(keyAdapter);\r
+\r
this.addWindowListener(new WindowAdapter()\r
{\r
public void windowClosing(WindowEvent e)\r
jalview.bin.JalviewLite.addFrame(this, title,\r
NEW_WINDOW_WIDTH,\r
NEW_WINDOW_HEIGHT);\r
-\r
-\r
}\r
\r
public AlignViewport getAlignViewport()\r
}\r
\r
\r
+ class MyKeyAdapter extends KeyAdapter\r
+ {\r
+\r
+ public void keyPressed(KeyEvent evt)\r
+ {\r
+ switch (evt.getKeyCode())\r
+ {\r
+ case 27: // escape key\r
+ deselectAllSequenceMenuItem_actionPerformed(null);\r
+ break;\r
+ case KeyEvent.VK_X:\r
+ if (evt.isControlDown() || evt.isMetaDown())\r
+ {\r
+ cut_actionPerformed(null);\r
+ }\r
+ break;\r
+ case KeyEvent.VK_C:\r
+ if (evt.isControlDown() || evt.isMetaDown())\r
+ {\r
+ copy_actionPerformed(null);\r
+ }\r
+ break;\r
+ case KeyEvent.VK_V:\r
+ if (evt.isControlDown() || evt.isMetaDown())\r
+ {\r
+ paste(true);\r
+ }\r
+ break;\r
+ case KeyEvent.VK_A:\r
+ if (evt.isControlDown() || evt.isMetaDown())\r
+ {\r
+ selectAllSequenceMenuItem_actionPerformed(null);\r
+ }\r
+ break;\r
+ case KeyEvent.VK_DOWN:\r
+ moveSelectedSequences(false);\r
+ break;\r
+ case KeyEvent.VK_UP:\r
+ moveSelectedSequences(true);\r
+ break;\r
+ case KeyEvent.VK_F:\r
+ if (evt.isControlDown())\r
+ {\r
+ findMenuItem_actionPerformed(null);\r
+ }\r
+ break;\r
+ case KeyEvent.VK_BACK_SPACE:\r
+ case KeyEvent.VK_DELETE:\r
+ cut_actionPerformed(null);\r
+ break;\r
+\r
+ }\r
+ }\r
+ }\r
+\r
+\r
public void inputText_actionPerformed(ActionEvent e)\r
{\r
CutAndPasteTransfer cap = new CutAndPasteTransfer(true, applet);\r
jalview.bin.JalviewLite.addFrame(tp, title, 600, 500);\r
}\r
\r
- void addTreeMenuItem(final TreePanel treePanel, String title)\r
+ public void addTreeMenuItem(final TreePanel treePanel, String title)\r
{\r
final MenuItem item = new MenuItem(title);\r
sortByTreeMenu.add(item);\r
\r
public AlignmentPanel(AlignFrame af, final AlignViewport av)\r
{\r
+ this.addKeyListener(new KeyAdapter()\r
+ {\r
+ public void keyPressed(KeyEvent ke)\r
+ {\r
+ System.out.println("Align Panel "+ke);\r
+ }\r
+ });\r
+\r
try\r
{\r
jbInit();\r
hscroll.addAdjustmentListener(this);\r
vscroll.addAdjustmentListener(this);\r
\r
- seqPanel.seqCanvas.addKeyListener(new MyKeyAdapter());\r
- idPanel.idCanvas.addKeyListener(new MyKeyAdapter());\r
-\r
addComponentListener(new ComponentAdapter()\r
{\r
public void componentResized(ComponentEvent evt)\r
\r
}\r
\r
- class MyKeyAdapter\r
- extends KeyAdapter\r
- {\r
- public void keyPressed(KeyEvent evt)\r
- {\r
- // System.out.println(evt.getKeyCode()); log.\r
- switch (evt.getKeyCode())\r
- {\r
- case 27: // escape key\r
- alignFrame.deselectAllSequenceMenuItem_actionPerformed(null);\r
- break;\r
- case KeyEvent.VK_X:\r
- if (evt.isControlDown())\r
- {\r
- alignFrame.cut_actionPerformed(null);\r
- }\r
- break;\r
- case KeyEvent.VK_C:\r
- if (evt.isControlDown())\r
- {\r
- alignFrame.copy_actionPerformed(null);\r
- }\r
- break;\r
- case KeyEvent.VK_V:\r
- if (evt.isControlDown())\r
- {\r
- alignFrame.paste(true);\r
- }\r
- break;\r
- case KeyEvent.VK_A:\r
- if (evt.isControlDown())\r
- {\r
- alignFrame.selectAllSequenceMenuItem_actionPerformed(null);\r
- }\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
- {\r
- alignFrame.findMenuItem_actionPerformed(null);\r
- }\r
- break;\r
- case KeyEvent.VK_BACK_SPACE:\r
- case KeyEvent.VK_DELETE:\r
- alignFrame.cut_actionPerformed(null);\r
- break;\r
-\r
- }\r
- }\r
- }\r
\r
public void fontChanged()\r
{\r