Hello,

 

I used JChemPaintEidtorPanel like following and got error messages. Could you help me figure out what might be wrong?

 

 

 

import javax.swing.*;

import org.openscience.cdk.applications.jchempaint.*;

import java.awt.Dimension;

import java.awt.event.*;

import java.awt.BorderLayout;

import org.openscience.cdk.smiles.SmilesParser;

import org.openscience.cdk.Molecule;

import org.openscience.cdk.ChemModel;

import org.openscience.cdk.SetOfAtomContainers;

import org.openscience.cdk.SetOfMolecules;

import org.openscience.cdk.exception.*;

public class MolSketch

{

      public static void main(String[] ags)

      {

            MolSketch ms = new MolSketch();

      }

      public MolSketch()

      {

            SmilesParser parser = new SmilesParser() ;

            try{

Molecule mol=     parser.parseSmiles("c1ccccc1");

 

SetOfMolecules set = new SetOfMolecules();

set.addMolecule(mol);

 

ChemModel chem  = new ChemModel();

chem.setSetOfMolecules(set);

 

  model = new JChemPaintModel(chem) ;

 

}

catch(InvalidSmilesException ise)

      {

      System.out.println("smiles");

}

            JFrame frame  = JChemPaintEditorPanel.getNewFrame(model);

      frame.pack();

      frame.setVisible(true);

           

      }

}

 

 

The running result is it brings up greyout frame and bunch of errors messages in the console window. (You will see it after you run this program);

 

Your help is highly appreciated.

 

Thanks.

 

Hongmei

 

 

 

 

Reply via email to