Sunday, September 28, 2014

How to Build an App Around a Java Applet

How to Build an App Around a Java Applet

Instructions

    1

    Locate the Java source code file containing the applet's main method. If the applet consists of more than one file, then this is usually the one whose name is the same as the Applet itself. It will contain a "public void init()" method.

    2

    Change the part of the class declaration that reads "extends JApplet" to "extends JFrame" for the program to run as an app instead of an application.

    3

    Change the method declaration "public void init()" to "static public void main (String [] args)" to change the program's function from that of an applet to a regular app.

    4

    Add the lines "import javax.swing.;" and "import java.awt.;" to the very top of the source code file.



No comments:

Post a Comment