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).
Looking forward to giving eclipse a a go.
Many, many thanks !!
Maria
On Tuesday 03 Oct 2006 17:59, Bob Hanson wrote:
> But can't you just set your statusListener to intercept this action at a
> higher level (shown here for the applet)?
>
> class MyStatusListener implements JmolStatusListener {
> ...
> public void notifyAtomPicked(int atomIndex, String strInfo) {
> showStatusAndConsole(strInfo);
> if (pickCallback != null && jsoWindow != null)
> if (pickCallback.equals("alert"))
> jsoWindow.call(pickCallback, new Object[] { strInfo });
> else
> jsoWindow.call(pickCallback, new Object[] { htmlName, strInfo,
> new Integer(atomIndex) });
> }
> ...
> }
>
>
> Bob
>
/* 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
* Maria Brandl, 14.10.2006
* */
import javax.swing.*;
import java.io.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.table.*;
import org.openscience.jmol.app.*;
import org.jmol.api.*;
import org.jmol.adapter.smarter.SmarterJmolAdapter;
import Acme.JPM.Encoders.PpmEncoder;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfTemplate;
import com.lowagie.text.pdf.PdfWriter;
import com.obrador.JpegEncoder;
import org.jmol.viewer.*;
import org.jmol.api.*;
public class JmolExportExample extends JFrame
{
private Jmol jmolPanel;
public JmolViewer viewer;
public MyStatusListener myStatusListener;
public JmolExportExample()
{
super("Example of event tracking in Jmol");
jmolPanel = Jmol.getJmol(this,300, 300);
this.viewer = jmolPanel.viewer;
myStatusListener = new MyStatusListener();
viewer.setJmolStatusListener(myStatusListener);
this.getContentPane().add( jmolPanel, BorderLayout.CENTER );
}
public static void main( String args[] )
{
JmolExportExample example = new JmolExportExample();
example.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
example.setVisible( true ); // display frame
}
}
class MyStatusListener implements JmolStatusListener {
public void setStatusMessage(String statusMessage) {System.out.println("BLU");};
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);}
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