【发布时间】:2020-05-04 19:44:23
【问题描述】:
我目前正在开发一个自定义插件,但我不太明白为什么即使存在其他 Composite 元素,Composite 元素也会占用所有空间。
我的插件执行处理程序是这样的:
public class IwokGeneratorHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
Shell shell = window.getShell();
ApplicationWindow win = new ApplicationWindow(shell) {
@Override
protected Control createContents(Composite parent) {
parent.setSize(800, 600);
//first panel
Composite composite = new Composite(parent, SWT.NONE);
//x, y, width, height
composite.setBounds(10, 10, 424, 70);
//second panel
Composite composite_1 = new Composite(parent, SWT.NONE);
composite_1.setBounds(10, 86, 424, 309);
//third panel
Composite composite_2 = new Composite(parent, SWT.NONE);
composite_2.setBounds(10, 407, 424, 42);
return parent;
}
};
win.open();
return null;
}
}
但是,第一个 Composite 占用了主应用程序窗口的所有空间,而其他的则无法看到,无论窗口大小如何。我检查了很多次。
我是否缺少任何属性来防止元素自动填充?
提前谢谢你
【问题讨论】:
-
您是不是故意不设置任何布局或布局数据? eclipse.org/articles/Article-Understanding-Layouts/…
标签: java eclipse eclipse-plugin swt jface