Thanks for your help. Got another question: There is no JChemPaintViewerOnlyPanel(java.awt.Dimension) constructor although API document said there is. I used jchempaint-2.2.1.jar.
Have any idea? Thanks. Hongmei -----Original Message----- From: Nina Jeliazkova [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 12, 2006 3:21 AM To: Sun, Hongmei*; '[EMAIL PROTECTED]'; [EMAIL PROTECTED] Cc: [email protected] Subject: Re: [Cdk-user] jchempainteidtorpanel Hello, You'll need to assign 2D coordinates to the molecule (through StructureDiagramGenerator). JChemPaint can't display molecule without 2D coordinates. (well, perhaps such advice should go into JChemPaint help/tutorial, I went the same way some months ago ...) Regards, Nina "Sun, Hongmei*" <[EMAIL PROTECTED]> wrote: > > > 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 > > > > > > > > > > ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ Cdk-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/cdk-user

