import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.*; public class ControlSizeTest { public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); final Button checkbox = new Button(shell, SWT.CHECK); checkbox.setText("This should be a longer text"); final Button anotherButton = new Button(shell, SWT.PUSH); anotherButton.setText("Button"); shell.setLayout(new Layout() { @Override protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) { return new Point(200, 100); } @Override protected void layout(Composite composite, boolean flushCache) { checkbox.setBounds(0, 0, 100, 20); anotherButton.setBounds(100, 0, 100, 20); } }); shell.setSize(300, 200); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } }