首页 > 解决方案 > 我应该如何在 SWT 中显示 Pagebook 控件?

问题描述

我目前正在创建一个如下所示的wizardPage。 在此处输入图像描述 图中用pagebook控件来表示评论,写了如下代码。但是,它不能在 Pagebok 中表示。我应该如何解决它?

//更新 PageBook

protected void updatePageBook(final Composite parent) {
    Display.getDefault().asyncExec(new Runnable() {
        @Override
        public void run() {
            pageBook = new PageBook(parent, SWT.BORDER);
            pageBook.setLayoutData(createSubPane(getShell(), 2));
            availableSheetLabel = new Label(pageBook, SWT.BORDER);
            availableSheetLabel.setText(Messages.ChooseDomainFileWizardPage_12);
            pageBook.showPage(availableSheetLabel);
        }
    });
}

private Composite createSubPane(Composite parent, int numControl) {
    Composite result = new Composite(parent, SWT.NORMAL);
    GridLayout layout = new GridLayout(numControl, false);
    layout.marginWidth = layout.marginHeight = 0;
    result.setLayout(layout);
    result.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    return result;
}

标签: swtjface

解决方案


推荐阅读