2
我有一個複合(容器)是在另一個複合(對話框區域)。該容器包含一些UI元素。我怎樣才能讓對話框的大小變大或使其可調整大小。這裏是我的代碼可重新調整對話框在Java SWT
protected Control createDialogArea(Composite parent) {
setMessage("Enter user information and press OK");
setTitle("User Information");
Composite area = (Composite) super.createDialogArea(parent);
Composite container = new Composite(area, SWT.NONE);
container.setLayout(new GridLayout(2, false));
container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
Label lblUserName = new Label(container, SWT.NONE);
lblUserName.setText("User name");
txtUsername = new Text(container, SWT.BORDER);
txtUsername.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
txtUsername.setEditable(newUser);
txtUsername.setText(name);
return area;
}