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

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

Introduction

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

Prototype

public boolean sleep() 

Source Link

Document

Causes the user-interface thread to sleep (that is, to be put in a state where it does not consume CPU cycles) until an event is received or it is otherwise awakened.

Usage

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 .ja v  a2 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: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);/*from   w w w.  j a  va2  s.  c  o  m*/
    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);//from   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: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  ww  w .j ava  2 s. c  om
    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();/*w w w.  j a  v a 2 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:LabelWithText.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setSize(300, 200);//from   w w w . java  2  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: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. j  av  a  2  s  . com*/
    shell.open();

    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            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(new Rectangle(5, 5, 100, 100));
    shell.pack();//from  w  w w  .ja  v  a  2s  .c om
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    display.dispose();
}

From source file:ComboSimpleCreate.java

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

    // Create a "simple" Combo
    Combo simple = new Combo(shell, SWT.SIMPLE);
    simple.setItems(ITEMS);/*w w  w .  j a  va  2  s. co m*/

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

From source file:CreateDropCombo.java

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

    // Create a dropdown Combo
    Combo combo = new Combo(shell, SWT.DROP_DOWN);
    combo.setItems(ITEMS);//from www. j  av  a  2s .c om

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