I’m wanting to convert a Java application that I’ve written into an applet. The application uses a Model-View-Controller architecture.
Currently, the main() method is in the controller, which initialises a new model and a new view, and the application begins. I understand from here that something should extend JApplet, and contain an init() procedure.
My question is, where should this be? The View class creates a new instance of a JPane and adds all of the necessary controls to it. Instead of this, should it be creating a new instance of a class which extends JApplet? If so, how would the application launch? Would the main() procedure from the Controller have to become the init() procedure in the new class which extends View? I’m thoroughly confused! I can provide code if it helps, although the whole program is too large to include here.
Thanks,
Thomas
Don’t over think it too much! Just pull all your code into a common UI panel that can be added to a JFrame (when run as an application) or added to a JApplet (when run as an applet). Yes all your unit should be behind the applet init method but again pulled out into a common place. Have you tried this and run into problems? HTH