## Creating A Wizard

See Also

The Wizard wizard helps you by creating several of a wizard's basic Java source files, containing sample code, for you. When you want to create a wizard, you do not always need to use the Wizard wizard. The table below helps you to chose.

When you want to create a... | Use a...
--- | ---
New Project wizard | New Project Template wizard
New Sample wizard | New Project Template wizard
New File wizard | 'New File' registration type in the New Wizard wizard
Any other type of wizard | 'Custom' registration type in the New Wizard wizard

Depending on the type of wizard you want to create, do the following:

To create a New File wizard or a custom wizard:

1. Right-click a module project and choose New > Project Template.
2. In the Wizard Type page, you have to set the following:
   - Registration Type. Specifies where the user will be able to find the wizard in the IDE. See About Wizards for details.
   - Wizard Step Sequence. Specifies whether the Wizard wizard will create an implementation of this NetBeans API class:

     If you choose Static, an implementation of this NetBeans API class will not be created. The default progression from panel to panel will then be supported by your wizard, sequential progression without divergences or reversals.

     If you choose Dynamic, the Wizard wizard will create an implementation of the WizardDescriptor.Iterator class. This class guides progress from one panel to the next. The developer has a lot more freedom in coding the wizard, but has a more complex task since there are many more possibilities to consider. When you choose "Static", you can also extend the wizard to provide support for panel skipping and reversals, but the "Dynamic" type was made for this purpose. For example, the Add Server Instance wizard offers different panels depending on the type of server that the user wants to register.

   - Number of Wizard Panels. For each panel, the IDE creates two files—a visual panel (called `xxxVisualPanel.java`) and a wizard panel (called `xxxWizardPanel`) for retrieving the current values from the visual panel. Only if you enter an integer greater than 0, will you be able to progress to the next panel in the Wizard wizard.

   In the Name, Icon, and Location page, you have to set the following:

   - Class Name Prefix. Specifies the name of the new panels and action class.
   - Package. Specifies the name of the package where the class will be housed.
3. Only if the wizard will be registered as a New File wizard can you set the following items:
   - Display Name. Specifies the display name for the new wizard in the New File wizard.
   - Category. Specifies the New File wizard category where the new file wizard will be located.
   - Icon. Specifies the icon that will be displayed in the New File wizard.

   Click Finish.

After completing the wizard, you can do one or more of the following:

- Tweak the `layer.xml` file to change the icon or rearrange the position of the template in the New Project wizard.
- Change the description that will appear in the New Project wizard's Description box.

To create a new project template or a sample wizard:

1. Right-click a module project and choose New > Project Template.
2. In the Select Project page, you have to specify the project that you want to make available as a project template or sample. You can use the Project drop-down list to select an open project or you can click Browse to browse to a project in your filesystem.

   Click Next.

3. In the Name, Icon, and Location page, you have to set the following:
   - Template Name. Specifies the name of the new project template.
   - Display Name. Specifies the template's label. For example, you will see this label in the Module Manager. (Optional)
   - Category. Specifies the template's category. For example, this will enable the user to find the template more easily in the New Project wizard. (Optional)
   - Package. Specifies the name of the package where the classes will be housed.

   Click Finish.

After completing the wizard, you can do one or more of the following:

- Tweak the `layer.xml` file to change the icon or rearrange the position of the template in the New Project wizard.
- Change the description that will appear in the New Project wizard's Description box.

See Also
  About NetBeans Platform and Module Development
  About the NetBeans Platform

Legal Notices