// Creating a new composite widget Composite parent = new Composite(shell, SWT.NONE); // Setting the background color of the composite parent.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_BLUE)); // Retrieving the background color of the composite Color backgroundColor = parent.getBackground();
// Creating a new composite widget Composite child = new Composite(parent, SWT.NONE); // Setting the background color of the parent composite parent.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_BLUE)); // Retrieving the background color of the child composite Color backgroundColor = child.getBackground();In this example, we create a new Composite widget and set it as a child of another Composite widget. We then set the background color of the parent Composite using the `setBackground` method. We retrieve the background color of the child Composite using the `getBackground` method. Package Library: org.eclipse.swt.widgets