Java 无法在向导页中重新绘制SWT组合
我有一个组合,它有3个UI控件——SWT Group、SWT TabFolder和一个子组合,子组合有一个标签和一个链接。在一些用例中,SWT组是隐藏的,并且我希望空白空间不被看到,相反,复合物必须重新绘制,只显示SWT TabF文件夹和子复合,没有任何空间。 我使用的是composite.layout(true),但当SWT组被隐藏时,它仍然有空白。 有人能帮我解决这个问题吗Java 无法在向导页中重新绘制SWT组合,java,swt,jface,wizard,Java,Swt,Jface,Wizard,我有一个组合,它有3个UI控件——SWT Group、SWT TabFolder和一个子组合,子组合有一个标签和一个链接。在一些用例中,SWT组是隐藏的,并且我希望空白空间不被看到,相反,复合物必须重新绘制,只显示SWT TabF文件夹和子复合,没有任何空间。 我使用的是composite.layout(true),但当SWT组被隐藏时,它仍然有空白。 有人能帮我解决这个问题吗 TestComposite extends Composite{ private Label childlabe
TestComposite extends Composite{
private Label childlabel;
private Group group;
private TabFolder tabFolder;
private Button button;
TestComposite(Compossite parent){
super(parent, SWT.NONE);
setLayout(new GridLayout(1, true));
setFont(parent.getFont());
setBackground(parent.getBackground());
GridDataFactory.fillDefaults().grab(true, true).applyTo(this);
createControl();
}
public void createControl() {
this.group = new Group(this, SWT.SHADOW_IN);
this.group.setSize(this.getDisplay().getActiveShell().getSize());
this.button = new Button(this.group, SWT.PUSH);
GridDataFactory.swtDefaults().applyTo(this.button);
this.tabFolder = new TabFolder(this, SWT.TOP);
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true,
true).applyTo(this.tabFolder);
Composite childComposite = new Composite(this, SWT.NONE);
childComposite .setLayout(new GridLayout(2, false));
GridDataFactory.swtDefaults().grab(true, false).align(SWT.LEFT,
SWT.TOP).applyTo(childComposite );
this.childLabel = new Label(childComposite, SWT.NONE);
GridDataFactory.swtDefaults().grab(true, false).applyTo(childlabel);
setInput(abc);
enableVisibilityOfGroup(false);
}
public void enableVisibilityOfGroup(Boolean visible){
this.group.setVisible(visible);
// this shoudl redraw the UI and shown only tabFolder and label in the
// whole wizard page, but there is blank space in place of group
this.layout(true);
}
}
在
组上设置GridData
GridDataFactory.swtDefaults().applyTo(this.group);
使用GridData.exclude
在布局中排除/包括组:
public void enableVisibilityOfGroup(boolean visible) {
this.group.setVisible(visible);
GridData gridData = (GridData)this.group.getLayoutData();
gridData.exclude = !visible;
this.layout(true);
}
@格雷格-449。我已经包括了代码