Dear Nico,
I attach a tidied up and a bit extended version of
the example for exporting atom-information out of
Jmol, also copied over the LGPL-licence from
the example files of the current distribution.
Let me know if there's anything more to do.
Cheers,
Maria
On Thursday 05 Oct 2006 18:11, [EMAIL PROTECTED] wrote:
> De: Maria Brandl <[EMAIL PROTECTED]>
>
> >Dear Bob and Nico,
> >
> >Implementing JmolStatusListener and adding it to the
> >JmolViewer instance worked fine.
> >
> >I include the code of a little test-file (JmolExportExample.java).
>
> If this example can be useful for others, would you like to comment it a
> little (explaining its purpose) and put under LGPL license, so that we can
> include it in Jmol sources distribution like other examples ?
>
> >Looking forward to giving eclipse a a go.
>
> Should be straightforward
>
>
> Nico
>
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your opinions on IT & business topics through brief surveys -- and earn
> cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Jmol-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jmol-developers
/* $RCSfile$
* $Author: Maria Brandl$
* $10.10.2005$
* $Revision$
*
* Copyright (C) 2000-2006 The Jmol Development Team
*
* Contact: [EMAIL PROTECTED]
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA.
*
*
* JmolExportExample.java
* event tracking in a Jmol-application following
* Bob Hanson's concept
* compiled with: javac -classpath `pwd`:/where/ever/jmol-10.2.0/Jmol.jar JmolExportExample.java
* ran with: java -classpath `pwd`:/where/ever/jmol-10.2.0/Jmol.jar JmolExportExample
* */
import javax.swing.*;
import java.io.*;
import java.awt.*;
import java.util.*;
import org.openscience.jmol.app.*;
import org.jmol.viewer.*;
import org.jmol.api.*;
public class JmolExportExample
{
public static void main( String args[] )
{ // build TextField (monitor) to track atom info
JFrame monitorFrame = new JFrame();
JTextField monitor = new JTextField("Please load a molecule and click on atoms");
monitorFrame.getContentPane().add(monitor);
monitorFrame.pack();
// build Jmol
JFrame baseframe = new JFrame();
Jmol jmolPanel = Jmol.getJmol(baseframe,300, 300);
JmolViewer viewer = jmolPanel.viewer;
// build and register event listener (implementation of JmolStatusListener)
// point "monitor"-variable in event listener to "monitor"
MyStatusListener myStatusListener = new MyStatusListener();
myStatusListener.monitor = monitor;
viewer.setJmolStatusListener(myStatusListener);
// showing monitor frame on top of Jmol
monitorFrame.setVisible(true);
}
}
class MyStatusListener implements JmolStatusListener {
// JTextField monitor used to broadcast atom tracking out of Jmol
public JTextField monitor;
public void setStatusMessage(String statusMessage) {System.out.println(statusMessage);};
public void notifyFileLoaded(String fullPathName, String fileName,
String modelName, Object clientFile,
String errorMessage)
{System.out.println("loaded " + fileName);}
public void scriptEcho(String strEcho) {System.out.println(strEcho);}
public void scriptStatus(String strStatus) {System.out.println(strStatus);}
public void notifyScriptTermination(String statusMessage, int msWalltime) {System.out.println(statusMessage);}
public void handlePopupMenu(int x, int y) {System.out.println("");}
public void notifyMeasurementsChanged() {System.out.println("measurements changed");}
public void notifyFrameChanged(int frameNo) {System.out.println("frame changed");}
public void notifyAtomPicked(int atomIndex, String strInfo) {System.out.println(strInfo);
monitor.setText(strInfo);}
public void showUrl(String url) {System.out.println(url);}
public void showConsole(boolean showConsole) {System.out.println("Status of Console " + showConsole);}
}
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Jmol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers