如何删除 GridLayout 组合中行之间的间距?

How to remove the spacing between rows in a GridLayout composite?

这些只是示例代码。我创建了一个 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 的新手所以..

谢谢!!

GridLayoutverticalSpacing字段设置行间距,所以:

gl_composite.verticalSpacing = 0;

使用 horizontalSpacing 作为列间距。

两个值的默认值都是5