Hi all,

I'm trying to integrate JmolSimpleViewer to a web project which need
to export protein image. I used a BufferedImage to render on,  with
the source below. (Actually it's groovy code, but it doesn't matters.)

        BufferedImage bffImg = new BufferedImage(width, height,
BufferedImage.TYPE_INT_RGB)
        Graphics2D gfx = (Graphics2D) bffImg.getGraphics()
        viewer.openStringInline(fileContent)
        viewer.evalString("cartoons only;color structure;")
        Thread.sleep(1000)
        viewer.renderScreenImage(gfx, currentSize, rectClip)
        ByteArrayOutputStream baos = new ByteArrayOutputStream()
        ImageIO.write(bffImg, "PNG", baos)

But, it seems that viewer.openStringInline() and viewer.openFile()
both loads file in another thread. If I call
viewer.renderScreenImage() right after viewer.openStringInline(), a
black image with only "Jmol" on it is rendered. Currently, I'm using
Thread.sleep() to wait the file to be loaded. I wonder if there is
anyway to block the thread util the file is loaded.

Best Regards,

Duan Lian
Laboratory of Molecular Modeling and Design
School of Pharmacy
East China University of Science and Technology
Shanghai, China

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to