【发布时间】:2018-05-11 22:47:37
【问题描述】:
我想在 Eclipse 插件的向导页面中添加 scrolledComposite。在我实现 scrolledComposite 的 FirstPage 上一切正常。问题是,之后显示的 SecondPage 是空白的。
FirstPage 的初始化代码:
public void createControl(Composite parent) {
ScrolledComposite scroll = new ScrolledComposite(parent, SWT.NULL | SWT.V_SCROLL);
scroll.setLayoutData(new GridData(GridData.FILL_VERTICAL));
scroll.setAlwaysShowScrollBars(false);
scroll.setExpandVertical(true);
scroll.setExpandHorizontal(true);
scroll.setMinHeight(500);
scroll.setLayout(new GridLayout(1, false));
Composite container = new Composite(scroll, SWT.NULL);
GridLayout layout = new GridLayout();
container.setLayout(layout);
scroll.setContent(container);
setControl(container);
setPageComplete(false);
}
SecondPage createControl 代码是标准的,但我也尝试找到一个父级,这将是一个滚动 - 我认为这将是“嵌套”ScrolledComposite 的问题 - 就像这样:
ScrolledComposite scroll = null;
if(parent.getChildren() != null && parent.getChildren().length > 1 && parent.getChildren()[1] instanceof ScrolledComposite) {
scroll = (ScrolledComposite)parent.getChildren()[1];
}
scroll.setLayoutData(new GridData(GridData.FILL_VERTICAL));
Composite container = new Composite(scroll, SWT.NULL);
scroll.setContent(container);
scroll.setAlwaysShowScrollBars(false);
scroll.setExpandVertical(true);
scroll.setExpandHorizontal(true);
scroll.setMinHeight(500);
scroll.setLayout(new GridLayout(1, false));
GridLayout layout = new GridLayout();
container.setLayout(layout);
container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
但这种方法行不通。
有人在集成 ScrolledComposites 和多页 JFace 向导方面有经验吗?
【问题讨论】:
-
对第二页使用与第一页相同的代码应该可以工作。
标签: java eclipse swt jface wizard