FillLayout package com.hhstuhacker.test2; 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 Test1 { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display, SWT.MIN); shell.setText("This is a Shell"); shell.setSize(400, 400); shell.setLayout(new FillLayout(SWT.VERTICAL)); Button b1 = new Button(shell, SWT.NONE); Button b2 = new Button(shell, SWT.NONE); Button b3 = new Button(shell, SWT.NONE); b1.setText("Button1"); b1.pack(); b2.setText("Button2"); b2.pack(); b3.setText("B2"); b3.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } } RowLayout package com.hhstuhacker.test2; import java.io.FileInputStream; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; public class Test2 { public static void main(String[] args) throws Exception { Display display = new Display(); Shell shell = new Shell(display, SWT.SHELL_TRIM); shell.setText("This is A shell"); shell.setSize(500, 500); shell.setImage(new Image(display, new FileInputStream("c:/logo.gif"))); RowLayout layout = new RowLayout(SWT.VERTICAL); layout.marginTop = 10; layout.marginBottom = 20; layout.marginLeft = 30; layout.marginRight = 40; layout.spacing = 5; layout.fill = false; shell.setLayout(layout); Button b1 = new Button(shell, SWT.NONE); b1.setText("Button1"); Button b2 = new Button(shell, SWT.NONE); b2.setText("button2"); Button b3 = new Button(shell, SWT.None); b3.setText("Button3"); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } } GridLayout package com.hhstuhacker.test2; import java.io.FileInputStream; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; public class Test3 { public static void main(String[] args) throws Exception { Display display = new Display(); Shell shell = new Shell(display, SWT.SHELL_TRIM); shell.setText("This is a Shell"); shell.setSize(400, 400); shell.setImage(new Image(display, new FileInputStream("c:/logo.gif"))); GridLayout layout = new GridLayout(); layout.numColumns = 3; layout.makeColumnsEqualWidth = true; layout.marginTop = 10; layout.marginBottom = 20; layout.marginLeft = 30; layout.marginRight = 40; layout.horizontalSpacing = 6; layout.verticalSpacing = 8; shell.setLayout(layout); Button b1 = new Button(shell, SWT.PUSH); b1.setText("But1"); Button b2 = new Button(shell, SWT.PUSH); b2.setText("button2button2"); Button b3 = new Button(shell, SWT.PUSH); b3.setText("But3"); Button b4 = new Button(shell, SWT.PUSH); b4.setText("Bsd4"); Button b5 = new Button(shell, SWT.PUSH); b5.setText("Buttonbutton3"); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } }