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

License:asdf

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    Text text = new Text(shell, 0);
    text.setText("ASDF");
    text.setSize(64, 32);/*from  w  ww .j  av a 2s . co  m*/
    text.selectAll();
    shell.pack();
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}

From source file:HTMLRenderRelativeMemory.java

public static void main(String[] args) {
    /* Relative links: use the HTML base tag */
    String html = "<html><head>" + "<base href=\"http://www.eclipse.org/swt/\" >"
            + "<title>HTML Test</title></head>" + "<body><a href=\"faq.php\">local link</a></body></html>";

    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new FillLayout());
    Browser browser = new Browser(shell, SWT.NONE);
    browser.setText(html);//from   w w w.  j a va2  s .  c  om
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}

From source file:FileDialogFilterExtensions.java

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

    FileDialog dialog = new FileDialog(shell);
    dialog.setFilterExtensions(new String[] { "*.ico", "*.gif", "*.*" });
    String name = dialog.open();/*ww w . j  a  v  a 2 s.co m*/

    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();//from w  w w .j  a va2  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: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);/*from  www .  j  a  va  2 s  .c o m*/

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

From source file:TextPassword.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new FillLayout());
    Text text = new Text(shell, SWT.SINGLE | SWT.BORDER);
    text.setEchoChar('*');
    shell.pack();/*from   w  w  w.j  a  va 2  s.  c  o  m*/
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}

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 v a 2 s  .c  o  m
    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:MainClass.java

public static void main(String[] a) {
    Display d = new Display();
    Shell s = new Shell(d);

    s.setText("A Shell Composite Example");
    GroupExample ge = new GroupExample(s, SWT.SHADOW_ETCHED_IN);
    ge.setLocation(20, 20);/* w  w  w.  j ava  2s . c om*/

    s.open();
    while (!s.isDisposed()) {
        if (!d.readAndDispatch())
            d.sleep();
    }
    d.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  w  w  w  .ja va  2  s. com

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

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

}