import org.eclipse.swt.*; import org.eclipse.swt.custom.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; /** * @author Thomas Singer */ public class RegionTest { public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new FillLayout(SWT.VERTICAL)); final StyledText text = new StyledText(shell, SWT.BORDER); text.setText("hello world"); final Composite composite = new Composite(shell, SWT.NONE); composite.setBackground(display.getSystemColor(SWT.COLOR_DARK_GREEN)); composite.setLayout(new GridLayout()); final Region region = new Region(); region.add(new int[]{ 0, 0, 100, 0, 0, 100 }); composite.setRegion(region); final Button button = new Button(composite, SWT.PUSH); button.setText("Button"); shell.setSize(400, 300); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } }