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: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  ww w  . java 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();//  www  .ja  v a  2 s.  c  om
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    display.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 ww.  ja  v a2s . c  o m

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

    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");
    GroupExample ge = new GroupExample(s, SWT.SHADOW_ETCHED_IN);
    ge.setLocation(20, 20);/*from   ww w .j a v  a  2s  .c  o  m*/

    s.open();
    while (!s.isDisposed()) {
        if (!d.readAndDispatch())
            d.sleep();
    }
    d.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 .j a va2  s  .  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);//from w w w.j a v a2  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();// ww w. j a  v  a2  s  .c  o m
    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);/*  www.  j  a  va 2s .  co  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: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  ww .j a va2 s  .c o m*/
    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);/*from w  w  w.  ja v  a 2  s. c om*/

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