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

public static void main(String[] args) {
    Shell shell = new Shell();
    ToolBar bar = new ToolBar(shell, SWT.BORDER);
    for (int i = 0; i < 8; i++) {
        ToolItem item = new ToolItem(bar, SWT.PUSH);
        item.setText("Item " + i);
    }/*from  ww w  .j  a v a  2 s.  co  m*/
    bar.pack();
    shell.open();
    Display display = shell.getDisplay();
    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(500, 500);/*  ww  w  .ja  v  a2s. c  o m*/
    s.open();
    while (!s.isDisposed()) {
        if (!d.readAndDispatch())
            d.sleep();
    }
    d.dispose();
}

From source file:HelloWorld4.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new HelloWorld4().open(display);
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }//from w  ww .  j  av  a  2s.  c o m
    display.dispose();
}

From source file:org.eclipse.swt.examples.helloworld.HelloWorld1.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new HelloWorld1().open(display);
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }//from  w  w  w. j a v  a  2  s. c  om
    display.dispose();
}

From source file:HelloWorld3.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new HelloWorld3().open(display);
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }/*from  w  w w  . j  a v a 2s.  c  om*/
    display.dispose();
}

From source file:org.eclipse.swt.examples.helloworld.HelloWorld2.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new HelloWorld2().open(display);
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }//  w  w  w. j  a va2  s .  c  o  m
    display.dispose();
}

From source file:HelloWorld5.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new HelloWorld5().open(display);
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }/* ww w  .  j a va 2 s.c o m*/
    display.dispose();
}

From source file:MainClass.java

public static void main(String[] a) {
    Display d = new Display();
    Shell s = new Shell(d, SWT.CLOSE | SWT.RESIZE);
    s.setSize(300, 300);//w  w  w  .  j a v a2 s.co m
    s.open();
    while (!s.isDisposed()) {
        if (!d.readAndDispatch())
            d.sleep();
    }
    d.dispose();
}

From source file:Draw2D_Example.java

public static void main(String args[]) {
    final Label label = new Label("Press a button!");
    Shell shell = new Shell();

    LightweightSystem lws = new LightweightSystem(shell);
    Figure parent = new Figure();
    parent.setLayoutManager(new XYLayout());
    lws.setContents(parent);//from w w  w .  ja v  a 2s.c o  m

    Clickable above = new CheckBox("I'm above!");
    parent.add(above, new Rectangle(10, 10, 80, 20));
    ButtonModel aModel = new ToggleModel();
    aModel.addChangeListener(new ChangeListener() {
        public void handleStateChanged(ChangeEvent e) {
            label.setText("Above");
        }
    });
    above.setModel(aModel);

    Clickable below = new CheckBox("I'm below!");
    parent.add(below, new Rectangle(10, 40, 80, 20));
    ButtonModel bModel = new ToggleModel();
    bModel.addChangeListener(new ChangeListener() {
        public void handleStateChanged(ChangeEvent e) {
            label.setText("Below");
        }
    });
    below.setModel(bModel);

    ButtonGroup bGroup = new ButtonGroup();
    bGroup.add(aModel);
    bGroup.add(bModel);
    bGroup.setDefault(bModel);

    parent.add(label, new Rectangle(10, 70, 80, 20));
    shell.setSize(130, 120);
    shell.open();
    shell.setText("Example");
    Display display = Display.getDefault();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
}

From source file:ShellMini.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setMinimized(true);/*from   ww w  .  j  a  v  a  2s.c  o m*/
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}