Applet wizard

The Applet wizard creates an applet consisting of two files and adds them to the existing project:

See also

To open the Applet wizard,

  1. Create a project by choosing File|New Project and completing the Project wizard or open an existing project.
  2. Choose File|New to open the object gallery.
  3. Click the Web tab and double-click the Applet icon. (In JBuilder Personal, the Applet icon is on the New page.)


Enter applet class details

The wizard displays default names for the package and applet class file.

Package

Displays the package name derived from the project file. To assign a different package name to the applet file, click in the Package field and type a new name or select an existing package name from the drop-down list.

For more information on packages, see the "Packages" topic in the "Creating and managing projects" of Introducting JBuilder.

Class

Displays the default name assigned to the applet class. To rename it, click in the Class field and type a new name.

Base Class To Inherit From

Displays a drop-down list box to select the class from which you want to inherit: Applet (default) or JApplet.

Caution: Since most web browsers do not yet support Swing, choose Applet when developing web applets. Selecting JApplet as the base class requires the Java Plug-in and the HTML Converter from Sun to run the applet in a browser. See "Working with applets" for more information.

Generate Header Comments

Uses information from the project file as header comments at the top of the applet class file. This is the information entered in the Project wizard when creating the project file.

/**
 * Title:        
 * Description:  
 * Copyright:    Copyright (c) 2001
 * Company:      
 * @author 
 * @version 1.0
 */

Can Run Standalone

Creates a main() method in the applet file so it can be run alone for testing without being called from an HTML page.

Generate Standard Methods

Creates the standard applet methods: start(), stop(), destroy(), getAppletInfo(), and getParameterInfo().



Enter applet parameters

The grid on this page is used to enter the information that defines the parameters for your applet. This information generates param tags within the <applet> of the new HTML file, and parameter-handling code in the new applet java file.

Fill in one row of the grid for each parameter you wish to have.

Name

A name for the parameter. This is used as the name attribute in the <param> tag in the HTML file and as the name parameter of the corresponding getParameter() call in the Java source.

Type

The type of variable that is inserted in the Java source code of your applet for holding the value of the parameter coming in from the HTML page.

Desc

A brief description of the parameter. This is used to describe the parameter when external tools query the applet for what parameters it supports. An example of such a tool is the Applet|Info browser in appletviewer.

Variable

The name of the variable that is inserted into the Java source code of your applet for holding the value of the parameter coming in from the HTML page.

Default

The default value for the parameter. This is the value that the Java source code in this applet uses if a future HTML file that uses this applet doesn't have a <param> tag for this parameter. For an HTML file to provide this parameter, the name attribute in the <param> tag must exactly match what you've entered in the Name column in this row of the grid. Note that this matching is case sensitive.



HTML details

This page of the wizard controls the generation of the applet's HTML page that is inserted in your project for testing this applet. It controls all aspects of the HTML file and its <applet> tag, except for the parameters, which are controlled in Step 2 of the wizard.

Generate HTML Page

Determines if a new HTML page containing the <applet> tag is added to your project for this applet. If this check box is off, no HTML page is generated and all the other fields on this page are disabled. If this check box is on, the other fields on this page control the <title> tag and the attributes of the <applet> that are generated in the HTML page.

Important: JBuilder saves the applet HTML file to the project's output directory with the classes. This directory is named classes by default. The project's output path is set in the Output Path field on the Paths page of the Project Properties dialog box. This makes testing the applet with an external browser easier as the class files and the HTML file are in the correct location.

Title

The title of your HTML page which displays in the title bar of the web browser. This text is placed between the <title> tags in the header of the HTML page.

Name

The name of the applet, as displayed in browser messages about the applet. Note that this is not the code attribute of the <applet> tag. The code attribute is automatically generated from the applet class name entered on Step 1 of this wizard.

Codebase

The relative path or absolute URL to the applet .class file location. Use this field if the applet .class file is located in a different directory than the HTML file on the web server. You can think of this as a single node class path for the deployed applet .class file. A value of "." means that the .class file and the HTML file are in the same directory.

Width

The number of pixels you want the HTML page to provide for the width of the applet. This value is assigned to the width attribute in the <applet> on the HTML page.

Height

The number of pixels you want the HTML page to provide for the height of the applet. This value is assigned to the height attribute in the <applet> on the HTML page.

HSpace

The horizontal space to the left and right of the applet. Enter the number of pixels you want for this value. For example, if you enter a value of 20 pixels, a space 20 pixels wide is inserted on each side of the applet, between it and any surrounding text. This value is assigned to the hspace attribute of the <applet> tag on the HTML page.

VSpace

The vertical space above and below the applet. Enter the number of pixels you want for this value. For example, if you enter a value of 20 pixels, a space 20 pixels high is inserted both above and below the applet, between it and any surrounding text. This value is assigned to the vspace attribute of the <applet> on the HTML page.

Align

Controls how the applet is aligned on the HTML page. There are five attributes on the drop-down list:

This value is assigned to the align attribute in the <applet> tag of the HTML page. You can use these additional align values by modifying the <applet> tag in the HTML page after it is generated by this wizard: texttop, absmiddle, baseline, and absbottom.