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

public static void main(String[] args) {
    /* Relative links: use the HTML base tag */
    String html = "<html><head>"
            + "<base href=\"http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-swt-home/\" >"
            + "<title>HTML Test</title></head>" + "<body><a href=\"dev.html\">local link</a></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);//from  w w w . ja v a  2 s. com
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.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  w w w .  j  a v  a 2 s .co  m
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    display.dispose();
}

From source file:Snippet45.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    Scale scale = new Scale(shell, SWT.BORDER);
    scale.setSize(200, 64);//from  w w w . j a va  2  s.co m
    scale.setMaximum(40);
    scale.setPageIncrement(5);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}

From source file:Snippet22.java

License:asdf

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    Text text = new Text(shell, 0);
    text.setText("ASDF");
    text.setSize(64, 32);/*from   ww w  .j  a  v a2 s.  c om*/
    text.selectAll();
    shell.pack();
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}

From source file:ColorDialogSetInitColor.java

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

    ColorDialog dlg = new ColorDialog(shell);
    dlg.setRGB(new RGB(0, 0, 255));
    RGB rgb = dlg.open();//from  ww w.ja 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:HTMLRenderRelativeMemory.java

public static void main(String[] args) {
    /* Relative links: use the HTML base tag */
    String html = "<html><head>" + "<base href=\"http://www.eclipse.org/swt/\" >"
            + "<title>HTML Test</title></head>" + "<body><a href=\"faq.php\">local link</a></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);/*from www . j a va 2s . c om*/
    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.setText("A Shell Composite Example");
    GroupExample ge = new GroupExample(s, SWT.SHADOW_ETCHED_IN);
    ge.setLocation(20, 20);/*from   ww  w  . ja v  a  2  s .  c om*/

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

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();// ww  w  .ja  v a2 s. c om
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}

From source file:FileDialogFilterExtensions.java

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

    FileDialog dialog = new FileDialog(shell);
    dialog.setFilterExtensions(new String[] { "*.ico", "*.gif", "*.*" });
    String name = dialog.open();/*  w  ww.j ava  2  s .c om*/

    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();// w w  w. j av a2s  .  c  o  m
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    display.dispose();
}