Top
Interstage Studio User's Guide
FUJITSU Software

F.3.1 Developing Applet

An applet is a program that is embedded in and run on HTML when that HTML is displayed in a Web browser. In Interstage Studio, you can develop applets, which are a type of Java application.
Follow the instructions below to develop an applet that works in the same way as the application you created in Lessons 1 to 3 of "F.2 Client Application".

Creating an Java Application Project

  1. Start the workbench.

  2. Select [File] > [New] > [Project] from the menu bar.

  3. The [New Project] wizard is displayed. Select [Java Application Project] from the tree.

    Click [Next].

  4. The [Java Application Project] page is displayed. A project is created according to the information entered for items on this page.
    Enter the project information as follows.

    Setup Items

    Setup Content

    Project name

    MyCalApplet

    Click [Finish].

  5. The next step is to create an applet. Select [File] > [New] > [Other] from the menu bar in workbench. Then, select [Java] > [GUI] > [Applet] from the tree in the [New] wizard that appears.
    The [Applet Information] page is displayed. Enter information as follows.

    Setup Items

    Setup Content

    Package

    myapp.applet

    Click [Next].

  6. The [New Applet] dialog box is displayed.
    Select [Applet] on the [Java] tab, and then click [OK].

  7. The page for entering applet class information is displayed. Enter "Applet1" in the [Applet Name] field.
    Select [javax.swing.JApplet] as the base class.

    Click [Next].

  8. The [Create HTML] page is displayed. You can create an HTML template in which the applet is pasted.
    Specify the following settings.

    Setup Items

    Setup Content

    Generate HTML

    Checked

    Generate HTML for JBK plug-in

    Checked

    Page title

    Applet1

    Width of applet

    400

    Height of applet

    400

    Click [Next].

  9. The [Parameter Information] page is displayed.

  10. Parameters are not used, so you can delete "myItem0." Click [Delete].

    Click [Create].

  11. Java Form Designer starts.

Editing an Applet

  1. Refer to Lessons 1 to 3 of "F.2 Client Application" and, define properties, and describe event processes for the applet.

Building

  1. Building is executed automatically when resource files (such as the Java files) are saved if the [Build Automatically] item is enabled in the [Project] menu.
    If [Build Automatically] is disabled, right-click on the project and select [Build Project] or select [Build Project] in the [Project] menu.

  2. A JAR file is required so create it.
    Use the export wizard to create the JAR file.
    Select [File] > [Export] to start the export wizard.
    Select [Java] > [JAR file] in the export wizard.

  3. The JAR export wizard is displayed.
    Select [MyCalApplet] > [src] folder in [Select the resources to export] and enter the following settings.
    After setting the information, click [Finish].

    Setup Items

    Setup Content

    Select the resources to export

    src/

    Export generated class files and resources

    Checked

    JAR file

    MyCalApplet/MyCalApplet.jar

    Compress the contents of the JAR file

    Checked

    The following message is output when exporting JAR, but this does not indicate a problem.

Running

  1. Select the file (class) to be run. Then, click [MyCalApplet] > [src] > [myapp.applet] > [Applet1.java] in the [Package Explorer] view in workbench.

  2. Select [Run] > [Run] on the workbench menu bar.

  3. The [Run] dialog box opens.
    Select [Java Applet] from the [Configurations] tree. Then, click [New] at the bottom. A new configuration is added.
    Set the following in the [Main] tab:

    Setup Items

    Setup Content

    Name

    Applet1

    Project

    MyCalApplet

    Applet

    myapp.applet.Applet1

  4. Specify an applet width and height. Click the [Parameters] tab, and specify 400 in [Width] and [Height].

  5. Click [Run]. Applet Viewer opens with the applet displayed.

  6. Close Applet Viewer by clicking the [Close (X)] button on the title bar.

  7. Next, confirm that the applet runs correctly in a Web browser.
    To do this, open the "Applet1-JBKPlugin.html" file stored in the project folder in Internet Explorer.