ImageJ Applet problem running my code and opening images

Posted by thehobbit on
URL: http://imagej.273.s1.nabble.com/ImageJ-Applet-problem-running-my-code-and-opening-images-tp5000786.html

Hello everyone,

I'm trying to run my JAVA code as an applet using also ImageJ API, but it doesn't work.
I even have problem showing a simple image. Here is an example:

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);

    ImagePlus imp = new ImagePlus("http://osasapere.it/wp-content/uploads/2011/06/dna_500.jpg");
       
        imp.show();
       
    }
   
    public void destroy() {
    ImageJ ij = IJ.getInstance();
    if (ij!=null) ij.quit();
    }

}

The main istance of imageJ starts, but the image does not start at all.
I have more code to run as an applet, like:

            SelectionTool st = new SelectionTool();
            st.run("");

This code, for example, shows some JAVA button I made which run some imageJ API and so on, and it works when I run it in Eclipse, but fails to start as an applet.

A "funny" thing I noticed is this: when I try to use this applet http://rsb.info.nih.gov/ij/applet2/ it does not show the images passed as parameters as it says, but starts only the main instance of imageJ.
So, I don't know if the problem is my browser; I use Chrome.

Can someone help me please?

Thank you in advance