SystemIconImage.java Source code

Java tutorial

Introduction

Here is the source code for SystemIconImage.java

Source

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;

public class SystemIconImage {

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

        Label label = new Label(shell, SWT.NONE);
        label.setImage(display.getSystemImage(SWT.ICON_ERROR));
        label = new Label(shell, SWT.NONE);
        label.setText("SWT.ICON_ERROR");
        label = new Label(shell, SWT.NONE);
        label.setImage(display.getSystemImage(SWT.ICON_INFORMATION));
        label = new Label(shell, SWT.NONE);
        label.setText("SWT.ICON_INFORMATION");
        label = new Label(shell, SWT.NONE);
        label.setImage(display.getSystemImage(SWT.ICON_WARNING));
        label = new Label(shell, SWT.NONE);
        label.setText("SWT.ICON_WARNING");
        label = new Label(shell, SWT.NONE);
        label.setImage(display.getSystemImage(SWT.ICON_QUESTION));
        label = new Label(shell, SWT.NONE);
        label.setText("SWT.ICON_QUESTION");

        shell.setSize(400, 350);
        shell.open();
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch()) {
                display.sleep();
            }
        }

        display.dispose();
    }

}