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

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

Introduction

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

Prototype

public boolean readAndDispatch() 

Source Link

Document

Reads an event from the event queue, dispatches it appropriately, and returns true if there is potentially more work to do, or false if the caller can sleep until another event is placed on the event queue.

Usage

From source file:SingleLinefieldTextExample.java

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

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

    shell.open();/*from w w w.  j a va2s  .com*/
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            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");
    s.setLayout(new FillLayout());
    TextPaneComposite tpc = new TextPaneComposite(s);

    s.open();/*  ww w  .  ja va  2s  .c  om*/
    while (!s.isDisposed()) {
        if (!d.readAndDispatch())
            d.sleep();
    }
    d.dispose();
}

From source file:MainClass.java

public static void main(String[] a) {
    Display display = new Display();
    Shell shell = new Shell(display);
    Label label = new Label(shell, SWT.CENTER);
    label.setText("Hello, World");
    label.setBounds(shell.getClientArea());
    shell.open();/*from  www .  j a  va  2 s  . c om*/
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    display.dispose();
}

From source file:HTMLRendererInMemory.java

public static void main(String[] args) {
    String html = "<HTML><HEAD><TITLE>HTML Test</TITLE></HEAD><BODY>";
    for (int i = 0; i < 100; i++) {
        html += "<a href=\"http://www.java2s.com\">java2s.com</a><br><br>";
    }//  ww w  . j ava  2s .co m
    html += "</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);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            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.setSize(250, 250);/* w ww.  ja  v  a  2 s.  c  o  m*/
    s.setText("A Text Example");
    final Text text1 = new Text(s, SWT.SINGLE);
    text1.setBounds(10, 10, 100, 20);

    s.open();
    while (!s.isDisposed()) {
        if (!d.readAndDispatch())
            d.sleep();
    }
    d.dispose();
}

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

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setText("Snippet 74");
    Caret caret = new Caret(shell, SWT.NONE);
    caret.setBounds(10, 10, 2, 32);/* w  w  w  .  j  ava 2 s. c o  m*/
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}

From source file:PlainLabelExample.java

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

    // Create a label
    new Label(shell, SWT.NONE).setText("This is a plain label.");

    shell.open();//from www  . ja  va 2  s .c  o m
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            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.setSize(250, 250);//ww  w.j a  va 2  s  .c  om
    s.setText("A Text Example");
    Text text1 = new Text(s, SWT.MULTI | SWT.BORDER);
    text1.setBounds(0, 0, 250, 250);

    s.open();
    while (!s.isDisposed()) {
        if (!d.readAndDispatch())
            d.sleep();
    }
    d.dispose();
}

From source file:ShellStates.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.setMinimized(true);/* w w  w .  ja  va 2 s .c o m*/

    shell.open();
    // 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:ShellSmallImage.java

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

    Image small = new Image(display, "yourFile.gif");

    shell.setImage(small);//from  w w w  .j  a va 2  s.  c o  m

    shell.open();

    // Set up the event loop.
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            // If no more entries in event queue
            display.sleep();
        }
    }
    display.dispose();
}