Adding a Java applet to your Web page

You can use Claris Home Page to add Java applets, small applications written in the Java programming language, to your Web page. Java applets offer an endless possibility of special effects that can be as simple as making an image dynamic or as complex as monitoring real- time data from a browser. Applets can be downloaded from a Web server and run on most computers.

Many Java applets are available for free, or as shareware on the Web, for you to customize and use in your Web pages if you don't want to create them yourself. Claris Home Page 3.0 comes with some sample applet files you can modify or use as they are.

To view and interact with a Java applet, you need a "Java-enabled" Web browser, such as Netscape Navigator 3.0. You must preview your page in the browser for the applet to run.

Inserting the Java applet

When linking to a Java applet, you create a link to a .class file. This .class file may then reference other files, which need to be in the same directory (Windows) or folder (Macintosh). For more information about a specific Java applet, refer to the readme file or documentation included with the Java applet.

To insert a Java applet into a Web page:

  1. Place the insertion point in the page where you want the applet to appear and choose Applet from the Insert menu.
  2. In the Open dialog box, select the main applet class file (it must have the .cls or .class extension) and click Open.

    An icon representing the applet appears on your Web page.

Note If you did a complete install from the Claris Home Page CD-ROM disc, sample applets are located in the Contents folder in the Claris Home Page 3.0 folder.

Opening the Applet Object Editor

Once you've inserted the applet, you use the Applet Object Editor to specify the parameters of the applet.

To open the Applet Object Editor, do one of the following:

To apply any new settings you make in the Applet Object Editor, press Tab or click the close box of the Applet Object Editor.

Specifying the applet's parameters

Some applets are designed to be customized. For example, a ticker tape applet allows you to specify a value for the text parameter that scrolls your words across the screen. You can specify applet parameters and their values in the Applet Object Editor.

To specify a parameter for an applet:

  1. Select the applet icon in your page and open the Applet Object Editor.
  2. Click the Parameters tab.
  3. Click Add.

    A parameter is added to the list with the default name, New Parameter, appearing in the Name column.
  4. Click in the Name column of the new parameter.
  5. Select the words New Parameter, and type the name of the parameter you wish to add.
  6. Click in the Value column of the new parameter and type the value of the parameter you are adding.

To delete a parameter, select the parameter in the list and click the Remove button.

Macintosh: Click Restore All to clear the settings and reset all Name/ Value pairs to their original names.

To apply your changes, press Tab or click the close box of the Applet Object Editor.

Specifying the applet's size, alignment, and margins

You can use the Applet Object Editor to change the width or height of the applet, realign the applet in relation to text on the page, or set the amount of white space around the applet.

To apply your changes, press Tab or click the close box of the Applet Object Editor.

To change the height or width of the applet:

  1. Click the applet icon and open the Applet Object Editor.
  2. Click the Content tab if not already selected.
  3. Type a new size in the Width and Height text boxes.

To change the alignment of the applet in relation to text on the page:

  1. Click the applet icon and open the Applet Object Editor.
  2. Click the Content tab if not already selected.
  3. Select an alignment type from the Alignment pop-up menu.

    Choose this option

    To do this

    Top

    Align the top of the applet with the top of the text next to it.

    Middle

    Align the middle of the applet with the text next to it.

    Bottom

    Align the bottom of the applet with the bottom of the text next to it.

    Left or Right

    Place the applet on the left or right side of the page and have text flow around it.


To set the amount of space around the applet:

  1. Click the applet icon and open the Applet Object Editor.
  2. Click the Content tab if not already selected.
  3. Type a number from 0 to 100 in the HSpace and VSpace text boxes.

Adding extra HTML to the applet element

You can add your own additional HTML directly to the applet element using the Applet Object Editor.

Note This is an advanced feature that requires knowledge of HTML; it specifies additional parameters for the <APPLET> tag.

To add extra HTML to an applet:

  1. Double-click the applet icon to open the Applet Object Editor.
  2. Click the Extended tab and type the HTML in the Extra HTML Attributes text box.

    The HTML that you type is added to the <APPLET> tag.

To specify an alternate HTML tag that is used by browsers when the other tag is unsupported:

  1. Double-click the applet icon to open the Applet Object Editor.
  2. Click the Extended tab and type the alternate HTML in the Alternate HTML text box.

    The HTML that you type is added to the <APPLET> tag.

Changing the name or location reference to the applet

When you insert an applet into your Web page, the applet name and location-the path to the folder where the applet is located-appears in the Applet Object Editor. You can change the name and location to refer to a different applet. Claris Home Page updates the reference to the new applet file.

To change the name or location of the applet:

  1. Click the applet icon and open the Applet Object Editor.
  2. Click the Content tab.
  3. In the Name and Location text boxes, type a new name and path for the applet file, or click the Browse button to find and select the applet file.
  4. Close the Applet Object Editor to apply your changes.

To have two applets on the same page find and communicate with each other, you need to specify an instance name for both of them.

To specify the applet instance name:

  1. Click the applet icon and open the Applet Object Editor.
  2. Click the Extended tab.
  3. In the Instance Name text box, type a name for the applet file.
  4. Repeat these steps for the other applet, giving it the same name in the Instance Name text box.
  5. Close the Applet Object Editor to apply your changes.

Providing an alternative message

You can provide an alternative message to appear instead of the applet whenever a page containing applets is viewed with a browser that does not support applets.

To provide an alternative message:

  1. Click the applet icon and open the Applet Object Editor.
  2. Click the Content tab.
  3. In the Alt Label text box, type a message.
  4. Close the Applet Object Editor to apply your changes.


Previous topic | Contents