PrintWarning.java Source code

Java tutorial

Introduction

Here is the source code for PrintWarning.java

Source

import org.eclipse.swt.graphics.Device;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

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

        Device device = shell.getDisplay();

        // By setting warnings to true and then getting warnings, we know if the
        // current platform supports it
        device.setWarnings(true);
        System.out.println("Warnings supported: " + device.getWarnings());

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

    }
}