Applet Wizard
The Applet Wizard creates an applet consisting of two files and adds them to the existing project. (If no project is open, JBuilder runs the Project Wizard first before it runs the Applet Wizard.)
The Applet Wizard creates the following two files:
- An .html file containing an APPLET tag referencing your applet class. This is the file you should select to run or debug your applet.
- A Java class that extends Applet. This is your main UI container, to which you'll add UI components using the UI Designer.
To open the Applet Wizard, choose File|New, then double-click the Applet icon.
The Applet Wizard consists of three steps:
Step 1 of 3
Applet Class
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 in a new name.
For more information on packages, see the Packages topic in the "Creating and managing projects" of Getting Started with JBuilder.
Class
Displays the default name assigned to the applet class. To rename it, click in the Class field and type in a new name.
File
The full path and .java file name for the applet class. This file path and name is constructed from the source path node under which the project exists, plus the contents of the Package and Class fields. This field is not editable. If the path or name are not correct, edit the Package and Class name fields on this page of the wizard. The file will be created with the location and name indicated here.
Applet Style
Use only core JDK and Swing classes
Restricts auto-generated code to the JDK and Swing classes.
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: Your Product Name
//Version:
//Copyright: Copyright (c) 1997
//Author: Your Name
//Company: Your Company
//Description: Your description
Can run standalone
Createsa 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: show(), close(), and dispose().
Step 2 of 3
Applet parameters
The grid on this page is used to enter the information that defines the parameters for your applet. This information will generate PARAM tags within the APPLET tag 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.
- To select a cell, click it or use the keyboard navigation arrows to move to it.
- To enter a value in a cell, type in a value, or select one if a drop-down list exists.
- To add a new parameter, click the Add Parameter button.
- To remove a parameter, click in any cell of the parameter row, then click the Remove Parameter button.
Name
A name for the parameter. This will be used to provide the NAME attribute in the PARAM tag in the HTML file, and to provide the name parameter of the corresponding getParameter() call in the Java source.
Type
The type of variable that will be inserted into 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 will be 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. (JBuilder runs and debugs applets in AppletViewer.)
Variable
The name of the variable that will be 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 will use if some future HTML file that uses this applet has no 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.
Step 3 of 3
HTML Page
This page of the wizard controls the generation of the HTML page that will be inserted into 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 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 tag that will be generated in the HTML page.
Title
The title of your HTML page. This text will be 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 tag 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 used with this HTML page isl not be placed in the same directory on the web server as the HTML page (or in the appropriate directory for the applet's package). You can think of this as a single node class path for the deployed applet .class file.
Width
The number of pixels you want the HTML page to provide for the width of the applet. This value will be assigned both to the WIDTH attribute in the APPLET tag on the HTML page, and to the width property of the applet's XYLayout in the Java source.
Height
The number of pixels you want the HTML page to provide for the height of the applet. This value will be assigned both to the HEIGHT attribute in the APPLET tag on the HTML page, and to the height property of the applet's XYLayout in the Java source.
HSpace
The amount of 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 will be inserted on each side of the applet, between it any surrounding text. This value will be assigned to the HSPACE attribute of the APPLET tag on the HTML page.
VSpace
The amount of 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 wide will be inserted both above and below the applet, between it any surrounding text. This value will be assigned to the VSPACE attribute of the APPLET tag on the HTML page.
Align
Controls how the applet will be aligned on the HTML page. There are three attributes on the drop-down list:
- TOP aligns the top of the applet with the top of the tallest item in the line.
- MIDDLE aligns the middle of the applet with the middle of the text.
- BOTTOM aligns the bottom of the applet with the bottom of the text.
This value is assigned to the ALIGN attribute in the APPLET tag of the HTML page. You can use other ALIGN values, such as LEFT or ABSBOTTOM by modifying the APPLET tag in the HTML page after it is generated by this wizard.