简体   繁体   中英

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

these are just sample codes. I created a GridLayout composite and removed the margins. But there are still spaces in between the rows.

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);

I need the rows to not have any spaces in between. The composites are bordered since I need to have a line below . I'm new to SWT so..

Thanks!!

The verticalSpacing field of GridLayout sets the spacing between rows, so:

gl_composite.verticalSpacing = 0;

Use horizontalSpacing for spacing between columns.

The default for both values is 5

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM