Hyperwire Module Development Kit (MDK) —
Writing Hyperwire Modules in Java


Contents

Introduction
Components of a Plug-In Module
Location of the Plug-In Components
Registering the Plug-In Module
Plug-In Module Icons
Java Plug-In Code
The Interface with Hyperwire
Applet Life Cycle
Event Handling
Input Ports
Output Ports
Module-Specific Properties
Visual Plug-In Modules
Radio Button Modules
Synchronizing Modules with the Refresh Daemon
Creating a Subwindow
Subclassing Hyperwire Modules
MDF File Format
MDF File Entries
HwBasicUserPlugIn Class
HwVisualUserPlugIn Class
BasicRunService Interface
VisualRunService Interface

Index of Methods

Introduction

With the Module Development Kit (MDK), you can use Java to develop your own Hyperwire modules. Plug-in modules are a way to extend the functionality of Hyperwire titles. You can use them to incorporate existing Java applets into Hyperwire. You can also use them for special purposes. For example, if you have programming experience, you will probably find it easier to code involved calculations in Java than to set up the equivalent calculation using Hyperwire modules and wires.

The Hangman module in the Xtras folder is an example of a plug-in module created with Java. You can find the Java source for Hangman and other MDK examples in the file \Hyperwire\Classes\kinetix\hyperc1\userPlugIns.

As with regular Hyperwire modules, a plug-in module can be a nonvisual module that does processing. Or it can also have a visual component that appears in the Layout view and displays graphic images, has a graphical user interface, or both. A plug-in module can be a subclass of one of the standard Hyperwire module types.

To use the MDK, you should be familiar with Hyperwire. You should also be familiar with using Java to develop applets. To develop a Hyperwire plug-in module, a Java development environment such as Microsoft J++ or Symantec CAFE can be helpful.

Caution: If you use the Java Development Kit (JDK) that is available over the Web from Sun Microsystems, or another Java development product, you might encounter path conflicts between the Java compiler and interpreter provided with Hyperwire, and those of the other product. To resolve conflicts, check the DOS autoexec.bat variables PATH and CLASSPATH.

Hyperwire has its own runtime class library that communicates between an applet player and the Hyperwire modules, including plug-in modules. This runtime includes two interfaces with service methods that are available to the plug-in module for communicating with other modules via input and output ports, for handling the visual interface, and so on.

Tip: For miscellaneous methods that can be useful to an author in various situations, create a "miscellaneous" plug-in module to contain them.

Note: You can also create plug-in modules by using Hyperwire itself. Creating plug-in, custom modules with Hyperwire is described in the online Help topic "Creating Custom Modules," under "Examples."

Components of a Plug-In Module

A plug-in module consists of these components:

Be sure to place each kind of component in the proper location, so Hyperwire can locate it.

Location of the Plug-In Module Components

These are the locations for each kind of plug-in component:

Registering the Plug-In Module

Once you have created your plug-in module and installed all its components in the correct locations, register it with Hyperwire.

To register a plug-in module:

  1. Make sure all plug-in components are present in their correct locations.

  2. In Hyperwire, choose Files/Rebuild Modules Menu.

    If you installed the plug-in module correctly, its name and icon appear in the Modules pull-down menu and the Modules window. Authors using Hyperwire can now use the plug-in module.

    If Hyperwire encounters an error in the MDF file, or can't find a plug-in component, it displays a message to that effect and doesn't register the module.

Note: Exiting and restarting Hyperwire will also register your plug-in module, provided you installed it correctly.

When an author uses the Hyperwire Run command to compile and run a title that includes plug-in modules, Hyperwire can detect compilation errors in the title's main class but not in the plug-in classes. Normally a compilation error displays an alert dialog that lets the author choose between cancelling the run or proceeding to run the title anyway. Since plug-in errors aren't detected, the title runs even if the plug-in contains bugs. In this case, the title behaves erratically. If this happens, look at the Java Console window for a complete listing of the compiler's output, including error messages.

Plug-In Module Icons

Plug-in module icons are bitmap (.bmp) files that you can create using Paintbrush or another bitmap editor.

A plug-in module has a small icon and a large icon. The two versions of these are a 16-color (4-bit color) icon and an optional truecolor (24-bit color) icon. The 16-color icon is the default, but Hyperwire will use the truecolor version if the display is capable of it.

Both versions of the small icon must be 16 pixels square (16x16). Both versions of the large icon must be 32 pixels square (32x32).

In the MDF file, you can specify a transparent color for the icon. Bits that have this color show through to the default background gray of the Modules pull-down menu and the Modules window.

The icon for a folder in the Modules pull-down menu does not have an MDF file entry because it is not specific to a single module. This icon should be 16 x 16 pixels with 4-bit color (16 colors). Hyperwire always uses pure magenta (in hexadecimal values, red = ff, green = 00, blue = ff) as the transparent color for this icon.

Continue to "Java Plug-In Code"

Return to Contents