站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 4.1.0

NetBeans API Javadoc 4.1.0

Class WizardDescriptor allows developer to create wizard from supplied WizardDescriptor.Iterator or array of WizardDesriptor.Panel. It also allows wizard developer to easy satisfy UI Guidelines for Wizards in NetBeans.

WizardDescriptor can create wizard panel (steps, graphics, help on the left; subtitle and user panel on the right). To achieve that, developer have to use WizardDescriptor.putProperty() or JComponent.putClientProperty() in his/her panel to set needed properties (e.g. String[] for steps, URL for help, some Boolean for layout control, ...).

To create simple wizard try this:
WizardDescriptor wd = new WizardDescriptor(
    new WizardDescriptor.Panel[] { 
        myPanel1, 
        myPanel2, 
        myPanel3,
        myPanel4 
}); 
It will create four steps wizard with no additional graphic. To achieve creation of subtitle, steps pane, help tab, ... one have to set initialization properties.

Wizard panel initialization

Use WizardDescriptor.putProperty() to set following initialization properties. That was initialization part. All Boolean properties are Boolean.FALSE by default. Initialization properties could be set also in the first panel (through JComponent.putClientProperty()) of supplied iterator. Later change of these properties will not cause change of wizard behavior. Properties have to be set before TopManager.getDefault().createDialog(wd) is called.
Follow properties which could be changed at wizard runtime.

Wizard panel properties

These properties could be changed dynamically. In every panel set these client properties (JComponent.putClientProperty()):
  • Name "WizardPanel_helpURL", type java.net.URL
    Help url which explains your pane.


  • Name "WizardPanel_contentSelectedIndex", type java.lang.Integer
    Index of highlighted step in the content, the index is zero-based.


  • Name "WizardPanel_contentBackgroundColor", type java.awt.Color
    Color used as background of content pane.


  • Set name of panel JComponent.setName("First wizard panel"), used as first part of subtitle, second is WizardDescriptor.Panel.name() when you use "{0}{1}" message format.
All properties could be set with both alternatives (WizardDescriptor.putProperty() or JComponent.putClientProperty()) except "WizardPanel_helpURL" which can be set only with JComponent.putClientProperty() and the property "WizardPanel_errorMessage" which can be set only by WizardDescriptor.putProperty().
If both are used at the same time then WizardDescriptor.putProperty() matters. WizardDescriptor listens on property changes of not initialization properties and makes immediate changes.