From: Quinn, G. <qu...@sd...> - 2012-10-27 06:00:31
|
Wonder if anyone can point me in the right direction? I'm trying to update some two year old server code that I wrote which uses jmol classes to write to a buffer. That code still runs fine with the old jmol classes. I just updated the jmol classes to current ones (from the two year old ones) and now I'm getting blank (black) frames. The relevant code is below (some of it is from memory, so is approximate): Many thanks for any suggestions Greg private class JmolInstance { JmolViewer viewer; private Dimension currentSize; private Rectangle rectClip; private JPanel panel; public void getImage ( ) { try { panel = new JPanel(); viewer = Viewer.allocateViewer(panel, new SmarterJmolAdapter()); if(viewer == null) { System.err.println("OH NO! viewer is NULL!!!!"); } currentSize = new Dimension(); rectClip = new Rectangle(); viewer.openFile("http://www.rcsb.org/pdb/files/3SY7.pdb.gz"); viewer.evalString("set measurementUnits ANGSTROMS; select all;spacefill off; wireframe off; backbone off; cartoon on; color cartoon structure; color structure; select ligand;wireframe 0.16;spacefill 0.5; color cpk ; set antialiasdisplay true; select all; model 0;set frank off;save STATE state_1"); } catch(Exception et) { System.err.println("SYS MESSAGE" + et.getMessage()); } } void drawPic() { try { BufferedImage bufferedImage = new BufferedImage(sizeWidth, sizeHeight, BufferedImage.TYPE_INT_RGB); Graphics g = bufferedImage.getGraphics(); currentSize.width = 300; currentSize.height = 300; g.getClipBounds(rectClip); viewer.setScreenDimension(currentSize.width, currentSize.height); viewer.evalString("rotate x " + Integer.toString((currentY - oldY)/2) + ";rotate y " + Integer.toString((currentX - oldX)/2) + ";"); viewer.renderScreenImage(g, currentSize, rectClip); //... } catch(Exception e) { // ... } } } |