Skip to content

Instantly share code, notes, and snippets.

@hofiorg
Last active April 16, 2018 07:30
Show Gist options
  • Save hofiorg/ff1fcb733d6b41ebada98ff0823246f9 to your computer and use it in GitHub Desktop.
Save hofiorg/ff1fcb733d6b41ebada98ff0823246f9 to your computer and use it in GitHub Desktop.
set background color to SWT composites recursive
private void colorSubComposites(Composite co, int color) {
Control [] controls = co.getChildren();
co.setBackground(getShell().getDisplay().getSystemColor(color));
for(Control control : controls) {
if(control instanceof Composite)
colorSubComposites((Composite)control, color);
}
}
// USAGE: colorSubComposites(co, SWT.COLOR_RED);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment