The applet above was started in visualization (view only) mode (i.e., the editing buttons cannot be seen). You can get into editing mode by selecting View > Toolbar in the applet. We have also used the autoscale parameter of the applet to fit the molecule into the window.
Note that the initial molecule and the magnification can also be set runtime, with the<script LANGUAGE="JavaScript1.1" SRC="../../../marvin.js"></script> <script LANGUAGE="JavaScript1.1"> <!--msketch_begin("../../..", 540, 480); msketch_param("mol", "../../../mols-2d/caffeine.mol"); msketch_param("viewonly", "true"); msketch_param("autoscale", "true"); msketch_end();//--> </script>
setMol
and the setScale
public methods.
Usually this simple method of loading a molecule works well enough. However, sometimes it is better if the applet does not make any network connection, for instance if the user's computer is off-line, and the page with the applet comes from the browser's cache. The next example shows the solution for this situation.