There is only one example program provided for JWizard, but it is a fairly detailed reproduction of a typical installation wizard. It includes steps such as a license which you have to agree to before installation can proceed and variant paths for standard and custom installation.

The example will not create any folders (even though it may ask you if it should create a folder) and will not install anything.

View the Example1 program.

If you download the FLib source, you can use Ant to build and run the example program:

cd JWizard
ant runExample1

The Example1 class is a subclass of JWizardDialog. It consists of seven steps (numbered 0 through 6), each step represented by an inner class which subclasses JWizardPanel. When the Example1 class is constructed, it constructs an instance of each step and adds it to its sequence. Information about the user's installation choices are stored in Example1 fields which can be easily accessed and modified by the inner classes.

In most cases, each step's components are fully created and added to the JWizardPanel at construction time. In step 5, a panel needs to display a summary of the user's installation choices. The text cannot be determined at construction time—it must be created just before the step is displayed.

Each step defines the flow (the next and previous steps). Sometimes the flow is constant and sometimes it is dynamic based on the user's entries. For instance, in step 1, the next step is -1 (which enables the Finish button) until the user agrees to the license terms. In step 3, we go to step 5 for a standard install or to step 4 for a custom install.

The cancel button is handled in the JWizardDialog. It confirms that the user wants to cancel the installation before proceeding with the exit.