这些只是示例代码。我创建了一个GridLayout合成并删除了边距。但是行之间仍然有空格。
Composite composite = new Composite(shell, SWT.NONE);
GridLayout gl_composite = new GridLayout(1, false);
gl_composite.marginWidth = 0;
gl_composite.marginHeight = 0;
composite.setLayout(gl_composite);
Composite composite_1 = new Composite(composite, SWT.BORDER);
GridData gd_composite_1 = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_composite_1.heightHint = 52;
gd_composite_1.widthHint = 802;
composite_1.setLayoutData(gd_composite_1);
composite_1.setLayout(new GridLayout(1, false));
Composite composite_2 = new Composite(composite, SWT.BORDER);
GridData gd_composite_2 = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_composite_2.widthHint = 803;
composite_2.setLayoutData(gd_composite_2);
我需要各行之间不要有任何空格。由于我需要在下面一行,所以复合材料带有边框。我是SWT的新手。.
谢谢!
答案 0 :(得分:1)
verticalSpacing
的{{1}}字段用于设置行间距,因此:
GridLayout
使用gl_composite.verticalSpacing = 0;
来分隔列间距。
两个值的默认值为horizontalSpacing