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

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

Introduction

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

Prototype

public void dispose() 

Source Link

Usage

From source file:DialogShellPositionIt.java

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

    Shell dialog = new Shell(shell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
    Point pt = display.getCursorLocation();
    dialog.setLocation(pt.x, pt.y);/*from  w  ww. j  a v  a  2  s  .c  o m*/
    dialog.setText("Dialog Shell");
    dialog.setSize(100, 100);
    dialog.open();

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

From source file:SettingItemsAddItemAtOnce.java

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

    // Create a multiple-selection list
    List multi = new List(shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);

    // Add the items all at once
    multi.setItems(ITEMS);/*from   www.  j a  v a2  s .  com*/

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

From source file:ToolItemButtonPush.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    ToolBar bar = new ToolBar(shell, SWT.BORDER | SWT.VERTICAL);
    for (int i = 0; i < 4; i++) {
        ToolItem item = new ToolItem(bar, SWT.PUSH);
        item.setText("Item " + i);
    }/* w  ww  .  j a va2s.c  om*/
    bar.pack();

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

From source file:ToolItemDropDown.java

License:asdf

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    ToolBar bar = new ToolBar(shell, SWT.BORDER | SWT.VERTICAL);
    for (int i = 0; i < 4; i++) {
        ToolItem item = new ToolItem(bar, SWT.DROP_DOWN);
        item.setText("asdf");
    }//w  w w .  j a  v a 2  s  .c om
    bar.pack();

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

From source file:ToolItemCheckBox.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    ToolBar bar = new ToolBar(shell, SWT.BORDER | SWT.VERTICAL);
    for (int i = 0; i < 4; i++) {
        ToolItem item = new ToolItem(bar, SWT.CHECK);
        item.setText("Item " + i);
    }/*  www  . j  ava2 s.c  om*/
    bar.pack();

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

From source file:ToolItemRadioButton.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    ToolBar bar = new ToolBar(shell, SWT.BORDER | SWT.VERTICAL);
    for (int i = 0; i < 4; i++) {
        ToolItem item = new ToolItem(bar, SWT.RADIO);
        item.setText("Item " + i);
    }/*  w w w . j av a 2 s . c o m*/
    bar.pack();

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

From source file:Snippet93.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new RowLayout());
    Label label = new Label(shell, SWT.NONE);
    GC gc = new GC(label);
    Point size = gc.textExtent("Hello");
    gc.dispose();/*from w  w w  . ja va 2  s .c  om*/
    label.setText("Hello -> " + size);
    shell.pack();
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}

From source file:ArrowButtonExample.java

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

    // Create three arrow buttons
    new Button(shell, SWT.ARROW);
    new Button(shell, SWT.ARROW | SWT.LEFT);
    new Button(shell, SWT.ARROW | SWT.DOWN);

    shell.pack();/*from   w ww  .  j av  a  2s.c o  m*/
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    display.dispose();
}

From source file:StyledTextActionBound.java

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

    StyledText styledText = new StyledText(shell, SWT.V_SCROLL | SWT.BORDER);
    styledText.setText("12345");

    int altEAction = styledText.getKeyBinding('e' | SWT.ALT);

    styledText.setBounds(10, 10, 100, 100);
    shell.open();/*w w w  .j  a  va  2  s  .  co m*/
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    display.dispose();

}

From source file:StyledTextSetKeyBinding.java

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

    StyledText styledText = new StyledText(shell, SWT.V_SCROLL | SWT.BORDER);
    styledText.setText("12345");

    styledText.setKeyBinding('i' | SWT.ALT, ST.TOGGLE_OVERWRITE);

    styledText.setBounds(10, 10, 100, 100);
    shell.open();/*from w  ww .ja  v  a2 s  . co m*/
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    display.dispose();

}