I'm trying to convert a Java application to an applet. I've spent some days scouring the Web for an answer, and I think I'm doing what everyone recommends.
The existing Application is a subclass of a Runnable subclass of a Panel, with a main() function which simply declares an instance of itself, then calls its own init() function. The Application init() creates a frame, and all the subsequent action takes place in the frame. It works fine as an application.
In trying to convert it, I just wrote an applet:
import java.applet.Applet;
public class Bapplet extends Applet
{
public Application application;
public void init()
{
application = new Application();
this.add(application);
application.init();
}
}
It then goes through the motions of starting the Application, including creating the frame and putting some of the furniture in it, but hangs before init() is complete.
I later added start() and stop() overrides to the applet which call the (Runnable, remember) application.start() / .stop(), but that didn't seem to help.
Any idea what am I likely to have missed / done wrong?
The existing Application is a subclass of a Runnable subclass of a Panel, with a main() function which simply declares an instance of itself, then calls its own init() function. The Application init() creates a frame, and all the subsequent action takes place in the frame. It works fine as an application.
In trying to convert it, I just wrote an applet:
import java.applet.Applet;
public class Bapplet extends Applet
{
public Application application;
public void init()
{
application = new Application();
this.add(application);
application.init();
}
}
It then goes through the motions of starting the Application, including creating the frame and putting some of the furniture in it, but hangs before init() is complete.
I later added start() and stop() overrides to the applet which call the (Runnable, remember) application.start() / .stop(), but that didn't seem to help.
Any idea what am I likely to have missed / done wrong?