为不同的IWizardPages设置不同的窗口标题

时间:2013-04-02 06:15:21

标签: java swt jface wizard

我有一个JFace向导,我想为不同的向导页面设置不同的窗口标题。目前我已经覆盖了名为setWindowTitle的方法,我从向导页面调用此方法,但标题没有出现在向导页面上。

向导代码

@Override
public void setWindowTitle(String newTitle) {
    super.setWindowTitle(newTitle);
}

在JFace WizardPage上是

private InstallationWizard iWizard = new InstallationWizard();
        iWizard.setWindowTitle(PropertyClass.getPropertyLabel(Constants.QTL_INSTALLATION_WIZARD_1));

1 个答案:

答案 0 :(得分:2)

在您的向导中覆盖getWindowTitle(),如下所示:

@Override
public String getWindowTitle() {
    if (getContainer() != null) {
        IWizardPage currentPage = getContainer().getCurrentPage();

        if (currentPage == wizardPage1)
            return "title1";
        else if (currentPage == wizardPage2)
            return "title2";
    }

    return "otherwise";
}
相关问题