Creating an Applet

See Also

Before you create an applet in the IDE, you must determine the type of project from which you want to run the applet. You can create the applet in one of the following two places:

  1. Within a Java Application project with Java WebStart enabled and with an applet descriptor specified in the application's JNLP file.
  2. Within a Java Class Library project that is a library for a Web Application project.
To create and run an applet that is called from a JNLP file:
  1. Choose File > New Project. Under Categories, select Java. Under Projects, select Java Application. Complete the wizard.
  2. Right-click the node of the new project in the Projects window and select New > Other. Under Categories, select Swing GUI Forms. Under File Types, select JApplet Form. Click Next.
  3. In the Class Name text field, type the name of your applet. In the Package text field, enter the package to which the applet will belong.
  4. Click Finish. The IDE creates the applet in the specified package. The applet opens in the Source editor.
  5. Design the applet with the GUI Builder or type code in the source view.
  6. Right-click the project's node, choose Properties, and select the Web Start panel.
  7. Select the Enable Web Start checkbox.
  8. Select the Applet Descriptor radio button and make sure that your applet is selected in the Applet Class combo box.
  9. Close the Project Properties dialog box.
  10. Right click the project node in the Projects window and choose Build from the pop-up menu.
  11. Right-click the project node and choose Run Project.
To create an applet in a web application:
  1. Choose File > New Project. Under Categories, select Java. Under Projects, select Java Class Library. Complete the wizard.
  2. Right-click the node of the new project in the Projects window and select New > Other. Under Categories, select Swing GUI Forms. Under File Types, select JApplet Form. Click Next.
  3. In the Class Name text field, type the name of your applet. In the Package text field, enter the package to which the applet will belong.
  4. Click Finish. The IDE creates the applet in the specified package. The applet opens in the Source editor.
  5. Design the applet with the GUI Builder or type code in the source view.
  6. Right click the project node in the Projects window and choose Build from the pop-up menu.
  7. Run the applet.
See Also
Setting Permissions for an Applet
Accessing an Applet from a JSP Page

Legal Notices