Define the margins and spacing properties : FillLayout « SWT « Java Tutorial

The default (initial) value of each property is 0.

Define the margins and spacing properties
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class MarginSpaceProperties {
  public static void main(String[] args) {
    Display display = new Display();
    final Shell shell = new Shell(display);

    FillLayout fillLayout = new FillLayout(SWT.HORIZONTAL);

    // Width of horizontal margins placed along the left and right edges    
    fillLayout.marginWidth = 5;
    // Height of vertical margins placed along the top and bottom edges
    fillLayout.marginHeight = 5;
    Button button1 = new Button(shell, SWT.PUSH);

    Button button2 = new Button(shell, SWT.PUSH);
    button2.setText("button number 2");

    Button button3 = new Button(shell, SWT.PUSH);

    shell.setSize(450, 100);;

    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {

17.95.1.Using FillLayout
17.95.2.Configure the layout orientation: HORIZONTAL and VERTICALConfigure the layout orientation: HORIZONTAL and VERTICAL
17.95.3.Define the margins and spacing propertiesDefine the margins and spacing properties
17.95.4.Set spacing propertiesSet spacing properties