Hi,
I'm using the latest version of the CDK and a Jmol version
corresponding to 10.00.40, though the problem also occurs with the
latest CVS version of Jmol
I have the following code to display a Molecule object:
import java.awt.Container;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JFrame;
import org.jmol.api.JmolViewer;
import org.openscience.cdk.interfaces.IMolecule;
import org.openscience.cdk.Molecule;
import org.openscience.cdk.AtomContainer;
public class ViewMolecule3D {
JmolPanel jmolPanel;
AtomContainer molecule = null;
String filename = null;
final static String strScript = "";
public ViewMolecule3D(IMolecule molecule) {
this.molecule = (AtomContainer)molecule;
}
public ViewMolecule3D(String filename) {
this.filename = filename;
}
public void show() {
JFrame frame = new JFrame("Molecule Viewer");
frame.addWindowListener(new ApplicationCloser());
Container contentPane = frame.getContentPane();
this.jmolPanel = new JmolPanel();
contentPane.add(jmolPanel);
frame.setSize(300, 300);
frame.setVisible(true);
JmolViewer viewer = jmolPanel.getViewer();
if (this.molecule != null)
viewer.openClientFile("", "", this.molecule);
else if (this.filename != null) {
}
String strError = viewer.getOpenFileError();
if (strError != null)
System.out.println(strError);
}
However when I call
new ViewMolecule3D(someMolecule) I get
Cannot display data in model: clientFile must be instance of AtomContainer or
ChemFile
Cannot display data in model: clientFile must be instance of AtomContainer or
ChemFile
Error in conditionCall.JavaException(cond) :
Java exception: java.lang.NullPointerException:
I'm a little confused as I am coercing the Molecule to an AtomContainer
Any pointers would be appreciated
Thanks,
-------------------------------------------------------------------
Rajarshi Guha <[EMAIL PROTECTED]> <http://jijo.cjb.net>
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
-------------------------------------------------------------------
Build a system that even a fool can use and
only a fool will want to use it.
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Jmol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers