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:ImagePaint.java

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

    Image image = new Image(display, 20, 20);
    Color black = display.getSystemColor(SWT.COLOR_BLACK);
    GC gc = new GC(image);
    gc.setForeground(black);//from   w w  w  .j  a v  a2 s .c o m
    gc.drawString("Test", 2, 2);

    gc.dispose();
    display.dispose();
}

From source file:ShellWindowToolTip.java

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

    shell.setToolTipText("Shell \n toolTip");

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

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

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setText("Snippet 1");
    shell.open();//from w ww  .  ja  va 2 s. c  o  m
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}

From source file:DirectoryDialogFilterPath.java

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

    DirectoryDialog dlg = new DirectoryDialog(shell);
    dlg.setFilterPath("C:/");

    String selectedDirectory = dlg.open();

    System.out.println(selectedDirectory);

    display.dispose();

}

From source file:SWTEventHandlingDisplay.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setText("Hello, world!");
    shell.open();//from  w ww.  j a va  2  s . com

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

From source file:FileDialogStartingDirectoryFileName.java

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

    FileDialog dlg = new FileDialog(shell, SWT.OPEN);

    dlg.setFilterPath("C:/");

    String fileName = dlg.open();
    if (fileName != null) {
        System.out.println(fileName);
    }// w  w  w  . j  av  a  2 s. c  om

    display.dispose();

}

From source file:DirectoryDialogTextMessage.java

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

    DirectoryDialog dlg = new DirectoryDialog(shell);
    dlg.setText("My Text");
    dlg.setMessage("My Message");
    String selectedDirectory = dlg.open();

    System.out.println(selectedDirectory);

    display.dispose();

}

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

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setText("Snippet 27");
    shell.setMinimized(true);//from   w ww. j a  v  a  2  s  .  c o  m
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}

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

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setText("Snippet 28");
    shell.setMaximized(true);//from w w  w. j  ava 2 s  .com
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}

From source file:FileDialogSaveDefaultFileName.java

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

    FileDialog dlg = new FileDialog(shell, SWT.SAVE);

    dlg.setFileName("defaultName");

    String fileName = dlg.open();
    if (fileName != null) {
        System.out.println(fileName);
    }/*from   w w  w.ja  v a 2  s.com*/

    display.dispose();

}