Composite parent = new Composite(shell, SWT.NONE); parent.setLayout(new GridLayout(2, false)); Layout layout = parent.getLayout();
Composite container = new Composite(shell, SWT.NONE); GridLayout layout = new GridLayout(2, false); container.setLayout(layout);In this example, a new Composite widget is created with two columns. The GridLayout object is instantiated with the specified properties, and then set as the layout manager for the container using the setLayout() method. The package library for this method is org.eclipse.swt.widgets.