设置 JFace 向导的大小

发布于 2024-09-11 21:16:04 字数 54 浏览 1 评论 0原文

我正在构建 Eclipse RCP 应用程序,但在设置 JFace 向导的大小时遇到​​问题。

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

山田美奈子 2024-09-18 21:16:04

是的,让 Eclipse 为您计算大小通常是个好主意。但是,如果您确实想要设置向导的大小,可以通过设置用于打开向导的 WizardDialog 的大小来完成。例如:

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

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
愚人国度 2024-09-18 21:16:04

事实证明,Wizard 的大小就是你最大的WizardPage 的大小。

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

素年丶 2024-09-18 21:16:04

要设置对话框的大小,请

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

禁用对话框可调整大小的功能,请将 SWT.RESIZE 位保留在自己的 WizardDialog 实现中:

// 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);
    ...
}

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);
    ...
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文