public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); Group group = new Group(shell, SWT.BORDER); group.setText("This is a group"); group.setLayout(new FillLayout()); Canvas canvas = new Canvas(group, SWT.NONE); canvas.addListener(SWT.Paint, new Listener() { public void handleEvent(Event event) { event.gc.setBackground(new Color(display, 0xff, 0, 0)); event.gc.fillRectangle(event.x, event.y, event.width, event.height); } }); shell.open(); while(!shell.isDisposed()) { if(!display.readAndDispatch()) display.sleep(); } display.dispose(); }