Set Size of JFace Wizard

寵の児 提交于 2019-11-28 07:29:25

问题


I am building an Eclipse RCP application and am having trouble on settings the size of a JFace Wizard.


回答1:


Yeah, it is generally a good idea to let Eclipse work out the size for you. However, if you really want to set the size of the wizard, you can do it by setting the size of the WizardDialog which you are using to open your wizard. For example:

Wizard wizard = new MyCustomWizard();
WizardDialog wizardDialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);
wizardDialog.setPageSize(WIDTH, HEIGHT);
// Could also use wizardDialog.setMinimumPageSize(WIDTH, HEIGHT) if that's more appropriate



回答2:


It turns out that the Wizard is the size of your largest WizardPage.




回答3:


To set the size of the dialog, it's

wizardDialog.getShell().setSize(WIDTH, HEIGHT)

To disable that the dialog is resizable, leave the SWT.RESIZE bit in an own WizardDialog implementation:

// original WizardDialog class
public WizardDialog(Shell parentShell, IWizard newWizard) {
    super(parentShell);
    setShellStyle(SWT.CLOSE | SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL | SWT.RESIZE);
    setWizard(newWizard);
    ...
}

// Own implementation without SWT.RESIZE
public NoResizeWizardDialog(Shell parentShell, IWizard newWizard) {
    super(parentShell);
    setShellStyle(SWT.CLOSE | SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL);
    setWizard(newWizard);
    ...
}


来源:https://stackoverflow.com/questions/3367075/set-size-of-jface-wizard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!