From: <ha...@us...> - 2009-12-11 02:45:30
|
Revision: 11891 http://jmol.svn.sourceforge.net/jmol/?rev=11891&view=rev Author: hansonr Date: 2009-12-11 02:45:20 +0000 (Fri, 11 Dec 2009) Log Message: ----------- test example Added Paths: ----------- trunk/Jmol/examples/basic/org/jmol/Test.java Added: trunk/Jmol/examples/basic/org/jmol/Test.java =================================================================== --- trunk/Jmol/examples/basic/org/jmol/Test.java (rev 0) +++ trunk/Jmol/examples/basic/org/jmol/Test.java 2009-12-11 02:45:20 UTC (rev 11891) @@ -0,0 +1,42 @@ +package org.jmol; + +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Rectangle; +import javax.swing.JFrame; +import javax.swing.JPanel; +import org.jmol.adapter.smarter.SmarterJmolAdapter; +import org.jmol.api.JmolAdapter; +import org.jmol.api.JmolViewer; + +public class Test extends JPanel { + + // Main application + public static void main(String[] args) { + (new Test()).viewer.loadInline(strXyzHOH); + } + + public Test() { + adapter = new SmarterJmolAdapter(); + viewer = JmolViewer.allocateViewer(this, adapter); + JFrame newFrame = new JFrame(); + newFrame.getContentPane().add(this); + newFrame.setSize(300, 300); + newFrame.setVisible(true); + } + + private final static String strXyzHOH = "3\nwater\nO 0.0 0.0 0.0\n" + + "H 0.76923955 -0.59357141 0.0\n" + "H -0.76923955 -0.59357141 0.0\n"; + + private JmolViewer viewer; + private JmolAdapter adapter; + private Dimension currentSize = new Dimension(); + private Rectangle rectClip = new Rectangle(); + + public void paint(Graphics g) { + getSize(currentSize); + g.getClipBounds(rectClip); + viewer.renderScreenImage(g, currentSize, rectClip); + } + +} Property changes on: trunk/Jmol/examples/basic/org/jmol/Test.java ___________________________________________________________________ Added: svn:mime-type + text/plain This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |