Hi,

The simple answer is that you are using sample code from the tutorial
that is for a development version, but cdk class files from the
release version. What you need is either:

1) use the development branch called jcp-primary (recommended)
2) use an older version of the cdk, where the drawing parts worked

unfortunately, the latest release really should not have the
Java2DRenderer in (and, indeed Egon removed it for even more recent
versions, I think). It has some very nasty bugs like drawing text
upside-down (on OSX, at least).

gilleain

On Fri, May 22, 2009 at 4:53 PM, sebi <sebastian.kl...@hispeed.ch> 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
> Cdk-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/cdk-user
>

------------------------------------------------------------------------------
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
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to