The approach shown here uses the OSP Frame Applet to embed the application's main window into an html page. As is the case with the OSP Button Applet, the program author creates a java Application and need not concern him/herself with the Applet API. The same simulation runs as a stand-alone application and as an applet.
Example: The classical-physics Helium Model is embedded into an html page in this example.
Frame Applet Parameters
The OSP Frame Applet acts as an intermediary that invokes an application's main method. For example, the Classical Helium application is embedded into this html page using the standard applet tag:
<applet code="org.opensourcephysics.davidson.applets.FrameApplet.class" archive="mech_helium.jar" name="framed_braided" width="300" height="350" align="top" codebase="jars"> <param name="target" value="org.opensourcephysics.davidson.twobody.HeliumWRApp" /> <param name="xmldata" value="braided.xml" /> <param name="permissions" value="sandbox" /> </applet>
The target tag specifies the name of the application that will be run by the FrameApplet. The xmldata tag specifies an initialization data file that will be passed to the HeliumWRApp application.
Note: A Java applet running within a web page can be a security threat. You should trust the author/originator of the applet and the applet should be signed with a security certificate.
If a program creates multiple frames, the applet chooses the embedded view as follows: