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

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

    StyledText text = new StyledText(shell, SWT.V_SCROLL | SWT.WRAP | SWT.BORDER);

    text.setBounds(10, 10, 100, 100);/*from   w w w.  j  av  a  2s . c om*/

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

}

From source file:PasswordFieldTextExample.java

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

    // Create a password text field
    new Text(shell, SWT.PASSWORD | SWT.BORDER);

    shell.open();//w  ww. j a v a2 s . c  om
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    display.dispose();
}

From source file:org.eclipse.swt.examples.ole.win32.OLEExample.java

public static void main(String[] args) {
    Display display = new Display();
    OLEExample example = new OLEExample();
    example.open(display);//  ww  w.j a va 2  s.  c  o m
    display.dispose();
}

From source file:Snippet182.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    Link link = new Link(shell, SWT.BORDER);
    link.setText("This a very simple <A>link</A> widget.");
    link.setSize(140, 40);/*ww w.  ja v a  2s  .  c om*/
    shell.pack();
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}

From source file:Snippet26.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    Combo combo = new Combo(shell, SWT.READ_ONLY);
    combo.setItems(new String[] { "A", "B", "C" });
    combo.setSize(200, 200);// w w  w  . j a v  a  2 s . c o  m
    shell.pack();
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}

From source file:ShellOnTop.java

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

    shell.open();//  w  ww.j ava2 s .  c o m
    // 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:NoLayoutSimple.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    Button button = new Button(shell, SWT.PUSH);
    button.setText("No layout");
    button.setBounds(5, 5, 50, 150);/* w ww  . j  a v a  2 s. c  o m*/

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

From source file:LabelWithText.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setSize(300, 200);// w  w  w  .ja  va2 s.c  o  m
    Label label = new Label(shell, SWT.CENTER);
    label.setText("No worries!");
    label.setBounds(shell.getClientArea());
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}

From source file:ImageCreateCode.java

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

    Shell shell = new Shell(display);
    shell.setLayout(new FillLayout());

    Label label = new Label(shell, SWT.NONE);
    label.setImage(getCheckedImage(display));

    shell.open();/*from  w  w w.  j  a va2  s . c o  m*/
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }

    display.dispose();
}

From source file:MeasureString.java

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

    GC gc = new GC(shell);
    Point size = gc.textExtent("Hellooooooooooooooooooooo");

    System.out.println("Hello -> " + size);
    shell.pack();//from  w ww. ja v a2  s .  c  o m
    shell.open();

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