Hello,

I am a newbie trying to integrate Jmol into an application, I tried using the method stated onJmol wiki which is the Integration.java
and i can't seem to load any model files (.ent etc) and all i have is a black screen.
Is there any way for me to open a protein file or a clearer method of intergrating Jmol onto my stand-available?


Here's a sample of my code. I'm not sure what is wrong.
-------------------------------------------------------------------------------------------------------
package org.jmol;

import java.awt.*;
import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JFrame;
import javax.swing.JPanel;

import org.jmol.adapter.smarter.SmarterJmolAdapter;
import org.jmol.api.JmolViewer;
import org.jmol.util.Logger;
import org.jmol.api.JmolCallbackListener;

public class Integration extends JFrame {
/*
* Demonstrates a simple way to include an optional console along with the applet.
*/
public static void main(String[] argv) {
JFrame frame = new JFrame("Integration");
frame.addWindowListener(new ApplicationCloser());
frame.setSize(1443,873);
Container contentPane = frame.getContentPane();
JmolPanel jmolPanel = new JmolPanel();
jmolPanel.setPreferredSize(new Dimension(200, 200));

// main panel -- Jmol panel on top

JPanel panel = new JPanel();
panel.setLayout(new BorderLayout());
panel.add(jmolPanel);

// main panel -- console panel on bottom

JPanel panel2 = new JPanel();
panel2.setLayout(new BorderLayout());
panel2.setPreferredSize(new Dimension(400, 100));
JTabbedPane tab = new JTabbedPane();
panel2.add(tab, BorderLayout.CENTER);
JButton button = new JButton("1");
tab.add("Tab 1", button);
button = new JButton("2");
tab.add("Tab 2", button);


panel.add("South", panel2);



contentPane.add(panel);
frame.setVisible(true);

// sample start-up script
String strError = jmolPanel.viewer.openFile("D:\\project1\\Testing 2\\caffeine.xyz");
//Viewer String view1 = viewer.openStringInline(strXyzHOH);
System.out.println("hello1");
System.out.println("strError is \""+strError+"\"");
System.out.println("viewer is \""+jmolPanel.viewer+"\"");
System.out.println("hello2");
if (strError == null) System.out.println("ERROR");
else Logger.error("oh no");
}
 
final static String strXyzHOH = "3\n" 
+ "water\n" 
+ "O  0.0 0.0 0.0\n"
+ "H  0.76923955 -0.59357141 0.0\n" 
+ "H -0.76923955 -0.59357141 0.0\n";
static class ApplicationCloser extends WindowAdapter {
@Override
public void windowClosing(WindowEvent e) {
System.exit(0);
}
}
static class JmolPanel extends JPanel {
JmolViewer viewer;

private final Dimension currentSize = new Dimension();
private final Rectangle rectClip = new Rectangle(); // ignored by Jmol

JmolPanel() {
viewer = JmolViewer.allocateViewer(this,new SmarterJmolAdapter(),null,null,null,null,null);
}

@Override
public void paint(Graphics g) {
getSize(currentSize);
g.getClipBounds(rectClip);
viewer.renderScreenImage(g, currentSize, rectClip);
}
}
}
---------------------------------------------------------------------------------