1 /*******************************************************************************
2  * Copyright (c) 2018 Red Hat and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     Red Hat - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.swt.tests.gtk.snippets;
15 
16 
17 import org.eclipse.swt.*;
18 import org.eclipse.swt.layout.*;
19 import org.eclipse.swt.widgets.*;
20 
21 /**
22  * @author Thomas Singer
23  */
24 public class Bug490280_ColorInheritanceTest {
25 
main(String[] args)26 	public static void main(String[] args) {
27 		final Display display = new Display();
28 
29 		final Shell shell = new Shell(display);
30 		shell.setLayout(new FillLayout());
31 
32 		final Composite panel = new Composite(shell, SWT.NO_RADIO_GROUP);
33 		panel.setLayout(new FillLayout());
34 		panel.setBackgroundMode(SWT.INHERIT_DEFAULT);
35 		panel.setBackground(display.getSystemColor(SWT.COLOR_CYAN));
36 
37 		final Label textLabel = new Label(panel, SWT.LEFT);
38 		textLabel.setText("hello");
39 
40 		shell.setSize(300, 200);
41 		shell.open();
42 
43 		while (!shell.isDisposed()) {
44 			if (!display.readAndDispatch()) {
45 				display.sleep();
46 			}
47 		}
48 
49 		display.dispose();
50 	}
51 }
52