Sounds like background color is set to black. There should be such a setting in renderer model. Did you check? Stefan
On Friday 22 May 2009 16:53:01 sebi wrote: > Hi > > I'm having some problems while drawing a molecule with the > Java2DRenderer. All I get is a black square with a N in white circles > for the nitrogen atoms. > (see http://www.abload.de/img/123triazol0c7h.png ) > I think I forgot to set something in the Renderer2DModel, but I couldn't > find any hints in the API or the maillist archive. > > I'm using the git version of CDK 1.2.x from 05.05.2009 (1.2.2 release) > with Sun Java 6, and I tried following code: > > ----------------------------------------------------------------- > //java.awt setup > BufferedImage img = new BufferedImage(200, 200, > BufferedImage.TYPE_INT_RGB); > Graphics2D g2d = img.createGraphics(); > g2d.setBackground(Color.WHITE); > > //create a molecule and assign coords > Molecule mol = MoleculeFactory.make123Triazole(); > StructureDiagramGenerator sdg = new StructureDiagramGenerator(); > sdg.setMolecule(mol); > try { > sdg.generateCoordinates(); > } catch (Exception ex) { } > mol = (Molecule) sdg.getMolecule(); > > // Renderer setup > Renderer2DModel model = new Renderer2DModel(); > // model.set??? > Java2DRenderer renderer = new Java2DRenderer(model); > > // paint and create file > renderer.paintMolecule(mol, g2d, new Rectangle(200, 200)); > try { > ImageIO.write(img, "PNG", new File("123Triazol.png")); > } catch (IOException ex) { } > ----------------------------------------------------------------- > > Can you please point me to the problem, or maybe a detailed example? > Thanks > Sebastian > > > --------------------------------------------------------------------------- >--- Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is > a gathering of tech-side developers & brand creativity professionals. Meet > the minds behind Google Creative Lab, Visual Complexity, Processing, & > iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian > Group, R/GA, & Big Spaceship. http://www.creativitycat.com > _______________________________________________ > Cdk-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/cdk-user -- Stefan Kuhn B. Sc. M. A. Software Engineer in the Chemoinformatics and Metabolism Team European Bioinformatics Institute (EBI) Wellcome Trust Genome Campus Hinxton, Cambridge CB10 1SD UK Phone +44 1223 49 2657 Fax +44 (0)1223 494 468 ------------------------------------------------------------------------------ Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT is a gathering of tech-side developers & brand creativity professionals. Meet the minds behind Google Creative Lab, Visual Complexity, Processing, & iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian Group, R/GA, & Big Spaceship. http://www.creativitycat.com _______________________________________________ Cdk-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/cdk-user

