Reputation: 71
I want the height of grpModelProperties
be lower. What should I do to distances of above and bottom of the text box in the group be the same?
public void createControl(Composite parent) {
Composite composite = new Composite(parent, SWT.NULL);
composite.setLayout(new FillLayout());
Group grpModelProperties = new Group(composite, SWT.SHADOW_IN);
grpModelProperties.setText("ETL Transformation Model");
grpModelProperties.setLayout(new GridLayout(2, false));
GridData data = new GridData(GridData.FILL_HORIZONTAL);
text = new Text(grpModelProperties, SWT.NONE);
text.setLayoutData(data);
Button button = new Button(grpModelProperties, SWT.PUSH);
button.setText("File System...");
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(getShell(), SWT.NULL);
String path = dialog.open();
if (path != null) {
File file = new File(path);
if (file.isFile())
displayFiles(new String[] { file.toString()});
else
displayFiles(file.list());
}
}
Upvotes: 1
Views: 553
Reputation: 111142
You have specified FillLayout
for the Composite
containing the Group
so the group is being stretched to fill the dialog area.
Use a different layout for the composite:
Composite composite = new Composite(parent, SWT.NULL);
composite.setLayout(new GridLayout());
Group grpModelProperties = new Group(composite, SWT.SHADOW_IN);
grpModelProperties.setText("ETL Transformation Model");
grpModelProperties.setLayout(new GridLayout(2, false));
// Layout data for the group in the composite,
// Fill the row, stays at the top of the dialog
grpModelProperties.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
Here I have used GridLayout
and set the GridData
for the group to just fill the row.
Upvotes: 4