-..
-protected JMenuItem groovyShell = new JMenuItem();
-..
-jbInit() {
-..
-groovyShell.setText("Groovy Shell...");
-groovyShell.addActionListener(new ActionListener()
-{
- public void actionPerformed(ActionEvent e) {
- groovyShell_actionPerformed(e);
- }
-});
-..
-}
-..
-protected void groovyShell_actionPerformed(ActionEvent e)
-{
-}
-..
-</pre></li>
-<li>jalview.gui.Desktop
-<pre>
-..
-/**
- * Accessor method to quickly get all the AlignmentFrames
- * loaded.
- */
-protected AlignFrame[] getAlignframes() {
- JInternalFrame[] frames = Desktop.desktop.getAllFrames();
-
- if (frames == null)
- {
- return null;
- }
- Vector avp=new Vector();
- try
- {
- //REVERSE ORDER
- for (int i = frames.length - 1; i > -1; i--)
- {
- if (frames[i] instanceof AlignFrame)
- {
- AlignFrame af = (AlignFrame) frames[i];
- avp.addElement(af);
- }
- }
- }
- catch (Exception ex)
- {
- ex.printStackTrace();
- }
- if (avp.size()==0)
- {
- return null;
- }
- AlignFrame afs[] = new AlignFrame[avp.size()];
- for (int i=0,j=avp.size(); i<j; i++) {
- afs[i] = (AlignFrame) avp.elementAt(i);
- }
- avp.clear();
- return afs;
-}
-
-/**
- * Add Groovy Support to Jalview
- */
-public void groovyShell_actionPerformed(ActionEvent e) {
- Console gc = new Console();
- gc.setVariable("Jalview", this);
- gc.run();
-}
-..
+def alf = Jalview.getAlignFrames();
+print alf[0].getTitle();
+def alignment = alf[0].viewport.alignment;
+def seq = alignment.getSequenceAt(0);