BackgroundColorImageInherit.java Source code

Java tutorial

Introduction

Here is the source code for BackgroundColorImageInherit.java

Source

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Shell;

public class BackgroundColorImageInherit {

    public static void main(String[] args) {
        final Display display = new Display();
        final Shell shell = new Shell(display);

        shell.setLayout(new RowLayout(SWT.VERTICAL));

        Color color = display.getSystemColor(SWT.COLOR_CYAN);

        Group group = new Group(shell, SWT.NONE);
        group.setText("SWT.INHERIT_NONE");
        group.setBackground(color);
        group.setBackgroundMode(SWT.INHERIT_NONE);

        shell.pack();
        shell.open();
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch())
                display.sleep();
        }
        display.dispose();
    }
}