ij.ImageJApplet Maven / Gradle / Ivy
Show all versions of ij Show documentation
package ij;
import java.applet.Applet;
/**
Runs ImageJ as an applet and optionally opens up to
nine images using URLs passed as a parameters.
Here is an example applet tag that launches ImageJ as an applet
and passes it the URLs of two images:
<applet archive="../ij.jar" code="ij.ImageJApplet.class" width=0 height=0>
<param name=url1 value="http://imagej.nih.gov/ij/images/FluorescentCells.jpg">
<param name=url2 value="http://imagej.nih.gov/ij/images/blobs.gif">
</applet>
To use plugins, add them to ij.jar and add entries to IJ_Props.txt file (in ij.jar) that will
create commands for them in the Plugins menu, or a submenu. There are examples
of such entries in IJ.Props.txt, in the "Plugins installed in the Plugins menu" section.
Macros contained in a file named "StartupMacros.txt", in the same directory as the HTML file
containing the applet tag, will be installed on startup.
*/
public class ImageJApplet extends Applet {
/** Starts ImageJ if it's not already running. */
public void init() {
ImageJ ij = IJ.getInstance();
if (ij==null || (ij!=null && !ij.isShowing()))
new ImageJ(this);
for (int i=1; i<=9; i++) {
String url = getParameter("url"+i);
if (url==null) break;
ImagePlus imp = new ImagePlus(url);
if (imp!=null) imp.show();
}
}
public void destroy() {
ImageJ ij = IJ.getInstance();
if (ij!=null) ij.quit();
}
}