Example usage for org.eclipse.swt.widgets Display dispose

List of usage examples for org.eclipse.swt.widgets Display dispose

Introduction

In this page you can find the example usage for org.eclipse.swt.widgets Display dispose.

Prototype

public void dispose() 

Source Link

Usage

From source file:RightalignTextExample.java

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

    // Create a right-aligned single-line text field
    new Text(shell, SWT.RIGHT | SWT.BORDER);

    shell.open();/*from w w  w . j  a  va  2  s  .c  om*/
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    display.dispose();
}

From source file:ShellTrimCloseTitleMinMax.java

public static void main(String[] args) {
    final Display display = new Display();
    final Shell shell = new Shell(display, SWT.SHELL_TRIM);
    shell.setLayout(new FillLayout());

    shell.open();/*w w w.  ja v a  2  s .  com*/
    // Set up the event loop.
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            // If no more entries in event queue
            display.sleep();
        }
    }
    display.dispose();
}

From source file:Snippet33.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.open();//from   w ww . java 2 s.co  m
    DirectoryDialog dialog = new DirectoryDialog(shell);
    dialog.setFilterPath("c:\\"); // Windows specific
    System.out.println("RESULT=" + dialog.open());
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}

From source file:SystemSettingChangeListener.java

public static void main(String[] args) {
    final Display display = new Display();
    Shell shell = new Shell(display);
    display.addListener(SWT.Settings, new Listener() {
        public void handleEvent(Event event) {
            System.out.println("Setting changed");
        }//from www.  j av a  2  s  . c  o m
    });

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

From source file:Snippet178.java

public static void main(String[] arg) {
    Display.setAppName("AppMenu"); // sets name in Dock
    Display display = new Display();
    hookApplicationMenu(display, "About AppMenu");
    Shell shell = new Shell(display);
    shell.setText("Main Window");
    shell.open();/*from   w  w  w  . j av  a 2 s  .c  o m*/
    while (!shell.isDisposed())
        if (!display.readAndDispatch())
            display.sleep();

    display.dispose();
}

From source file:DeviceDPI.java

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

    Device device = shell.getDisplay();/*from  ww w . ja  v  a  2s  . com*/

    System.out.println("getDepth(): " + device.getDepth());
    System.out.println("getDPI(): " + device.getDPI());

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

}

From source file:ShellApplicationModal.java

public static void main(String[] args) {
    final Display display = new Display();
    final Shell shell = new Shell(display, SWT.APPLICATION_MODAL);
    shell.setLayout(new FillLayout());

    shell.open();/*from  w  w  w.  jav  a2 s  .c  om*/
    // Set up the event loop.
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            // If no more entries in event queue
            display.sleep();
        }
    }
    display.dispose();
}

From source file:org.eclipse.swt.snippets.Snippet260.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new FillLayout());
    shell.setText("WebKit");
    final Browser browser;
    try {//  w ww  .  j a  v a2 s  .  c  o m
        browser = new Browser(shell, SWT.WEBKIT);
    } catch (SWTError e) {
        System.out.println("Could not instantiate Browser: " + e.getMessage());
        display.dispose();
        return;
    }
    shell.open();
    browser.setUrl("https://webkit.org/");
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}

From source file:org.eclipse.swt.snippets.Snippet351.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new FillLayout());
    shell.setText("WebKit");
    final Browser browser;
    try {/*from w w w  . j a v a 2s.  c o m*/
        browser = new Browser(shell, SWT.WEBKIT);
    } catch (SWTError e) {
        System.out.println("Could not instantiate Browser: " + e.getMessage());
        display.dispose();
        return;
    }
    shell.open();
    browser.setUrl("http://webkit.org");
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}

From source file:ShellToolWindow.java

public static void main(String[] args) {
    final Display display = new Display();
    final Shell shell = new Shell(display, SWT.SHELL_TRIM | SWT.TOOL);
    shell.setLayout(new FillLayout());

    shell.open();//from w ww .j  av  a  2 s  . com
    // Set up the event loop.
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            // If no more entries in event queue
            display.sleep();
        }
    }
    display.dispose();
}