An applet is designed to run within a browser. In other words, the applet is one
component of the larger browser application. To make an applet run as a standalone
application requires only a few steps. Essentially, you must create a Java Frame for the
applet to sit within (so the applet will sit within the Java Frame, instead of the
Browser).

The applet itself doesn't have to be changed to run within a Java Frame. Panels can be
placed directly onto Java frames. Since Applet is inherited from Panel, it is
"frame-ready".

Different methods for constructing your Java frame and mainline application are
explored.

A more usable standalone Java application will include a menu and the
ability to shut down the application. Such an application is demonstrated next.

A frame class called MyFrame is defined for the application. In the MyFrame's
constructor, a menu is added and the applet is added to the frame. The menu actions are
handled in the actionPerformed event. When the user chooses exit, the application is shown
down.

if(menuLabel.equals("Exit")) {
// close application, when exit is selected
dispose();
System.exit(0);
} // end if
} // end if
} // end ActionPerformed
} // end class

The only other thing that this standalone application requires is an application
mainline. This is defined in a separate class. MyFrame is defined, sized and made visible
in the application main method as shown below:

import java.awt.*;

public class AppMain

{

public static void main (String[] args) {

// define frame, its size and make it visible
Frame myFrame = new MyFrame();
myFrame.setBounds(10, 10, 700, 600); // this time use a predefined frame size/position
myFrame.setVisible(true);
} // end main method
} // end class

Generally speaking, an applet can easily be converted to an application if the applet
is the independent of the HTML page where it resides. If the applet relies on HTML pages
elements and dynamic "LiveConnect" calls to/from
JavaScript, then it will require more work to convert the applet to a standalone
application (because all the HTML/JavaScript interaction will have to be separately
migrated to Java).