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

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

    FontDialog dlg = new FontDialog(shell);
    FontData fontData = dlg.open();/* w  w  w . j av  a2  s  . c  o  m*/
    if (fontData != null) {
        Font font = new Font(shell.getDisplay(), fontData);

        font.dispose();
    }

    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);//from   w w  w  .ja  v a 2  s  . co  m
    s.setImage(new Image(d, "c:\\icons\\yourico.ico"));
    s.setText("A Shell Example");
    s.open();
    while (!s.isDisposed()) {
        if (!d.readAndDispatch())
            d.sleep();
    }
    d.dispose();
}

From source file:Snippet74.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    Caret caret = new Caret(shell, SWT.NONE);
    caret.setBounds(10, 10, 2, 32);//from   w  ww  .  j  av  a  2 s.  c  om
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}

From source file:org.eclipse.swt.examples.graphics.AdvancedGraphics.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new AdvancedGraphics().open(display);
    while (shell != null && !shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();//w w  w .ja  v  a  2  s. co  m
    }
    display.dispose();
}

From source file:DialogShellCreate.java

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

    Shell dialog = new Shell(shell);
    dialog.setText("Dialog");
    dialog.setSize(200, 200);//from w  w  w .j a  v a  2s  . c  o m
    dialog.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}

From source file:ColorDialogCreateGetColor.java

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

    ColorDialog dlg = new ColorDialog(shell);
    RGB rgb = dlg.open();// ww  w.j a v a2s .c o m
    if (rgb != null) {
        Color color = new Color(shell.getDisplay(), rgb);

        System.out.println(color.getRGB());

        color.dispose();
    }

    display.dispose();
}

From source file:ThickLinkDraw.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.open();//from  w w w .j  ava  2  s .c  o  m
    GC gc = new GC(shell);
    gc.setLineWidth(4);
    gc.drawRectangle(20, 20, 100, 100);
    gc.dispose();
    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 .  j  a v a2s . co  m
    while (!s.isDisposed()) {
        if (!d.readAndDispatch())
            d.sleep();
    }
    d.dispose();
}

From source file:MesssageBoxQuestionIconYESNOButton.java

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

    MessageBox messageBox = new MessageBox(shell, SWT.ICON_QUESTION | SWT.YES | SWT.NO);
    messageBox.setMessage("Is this question simple?");
    int rc = messageBox.open();

    System.out.println(rc == SWT.YES);
    System.out.println(rc == SWT.NO);

    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.  j a  v a  2 s  . c  om*/
    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();
}