1
我想在我的对话框窗口中显示可滚动的组合。与ScrolledComposite的Jface对话框
但它没有得到滚动条。我也没有得到“确定”“取消”按钮。
如何解决?
public class MyDialog extends Dialog {
public MyDialog (Shell parentShell) {
super(parentShell);
}
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText("test");
newShell.setSize(200, 100);
}
protected Control createDialogArea(Composite parent) {
ScrolledComposite sc = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
Composite composite = new Composite(sc, SWT.NONE);
composite.setLayout(new FillLayout(SWT.VERTICAL));
new Label(composite, SWT.NONE).setText("1111");
new Label(composite, SWT.NONE).setText("2222");
new Label(composite, SWT.NONE).setText("3333");
new Label(composite, SWT.NONE).setText("4444");
new Label(composite, SWT.NONE).setText("5555");
new Label(composite, SWT.NONE).setText("6666");
new Label(composite, SWT.NONE).setText("7777");
sc.setContent(composite);
sc.setExpandHorizontal(true);
sc.setExpandVertical(true);
return parent;
}
这不会帮助 – user1658192
@ user1658192此外删除此行:'newShell.setSize(200,100);' – Baz
否,这是对话框的大小。它应该是固定的。 – user1658192