packagedev.equo;importorg.eclipse.swt.SWT;importorg.eclipse.swt.graphics.Color;importorg.eclipse.swt.layout.FillLayout;importorg.eclipse.swt.layout.GridData;importorg.eclipse.swt.layout.GridLayout;importorg.eclipse.swt.widgets.*;import staticorg.eclipse.swt.events.SelectionListener.widgetSelectedAdapter;publicclassCompositeButtonSnippet{publicstaticvoidmain(String[]args){Displaydisplay=newDisplay();Shellshell=newShell(display);shell.setText("Shell with Composite and Checkbox Example");shell.setSize(400,300);// Configure shell layoutshell.setLayout(newFillLayout());// Set shell background colorshell.setBackground(display.getSystemColor(SWT.COLOR_RED));// Create a composite inside the shellCompositecomposite=newComposite(shell,SWT.BORDER);composite.setLayout(newGridLayout(1,false));// Set composite background colorcomposite.setBackground(display.getSystemColor(SWT.COLOR_MAGENTA));composite.setBackgroundMode(SWT.INHERIT_FORCE);// Add an explanatory labelLabellabel=newLabel(composite,SWT.NONE);label.setText("This is a Label inside a Composite inside a Shell:");label.setLayoutData(newGridData(SWT.CENTER,SWT.CENTER,false,false));// Create a checkbox inside the compositeButtoncheckbox=newButton(composite,SWT.CHECK);checkbox.setText("Check this option!");checkbox.setLayoutData(newGridData(SWT.CENTER,SWT.CENTER,false,false));// Set checkbox background color explicitlycheckbox.setBackground(display.getSystemColor(SWT.COLOR_YELLOW));// Print background colors of all componentsColorshellColor=shell.getBackground();ColorcompositeColor=composite.getBackground();ColorcheckboxColor=checkbox.getBackground();System.out.println("Shell background color: "+shellColor);System.out.println("Composite background color: "+compositeColor);System.out.println("Checkbox background color: "+checkboxColor);// Add listener to checkboxcheckbox.addSelectionListener(widgetSelectedAdapter(e->{booleanisSelected=checkbox.getSelection();System.out.println("Checkbox inside the Composite was "+(isSelected?"checked":"unchecked")+"!");MessageBoxmessageBox=newMessageBox(shell,SWT.ICON_INFORMATION);messageBox.setText("Information");messageBox.setMessage("Checkbox "+(isSelected?"checked":"unchecked")+" successfully!");messageBox.open();}));// Open the shellshell.open();while(!shell.isDisposed()){if(!display.readAndDispatch()){display.sleep();}}display.dispose();}}