从这张图可以一幕了然的看到向导对话框包含了一个向导配置,向导配置包含一或多个向导页,只要向导页的数量>1,向导对话框就自动出现back和next。
下面我们来试一下如何创建向导页:
1. 创建两个向导页
NewWizardPage1 extends WizardPage;
NewWizardPage2 extends WizardPage;
在createControl方法的最后加上this.setControl(composite);这段代码是必须要加的。
2. 创建向导
public class NewWizard extends Wizard {
private NewWizardPage1 page1;
private NewWizardPage2 page2;
public NewWizard {
this.page1 = new NewWizardPage1("page1");
this.page2 = new NewWizardPage1("page2");
this.addPage(this.page1);
this.addPage(this.page2);
}
};
3. 创建向导对话框
public class NewWizardDialog extends WizardDialog{}
4. 弹出向导对话框
NewWizardDialog wizard = new NewWizardDialog(getSite().getShell(), new NewWizard());
wizard.open();
So easy.
最新评论