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

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

Introduction

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

Prototype

public Display() 

Source Link

Document

Constructs a new instance of this class.

Usage

From source file:DirectoryDialogFilterPath.java

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

    DirectoryDialog dlg = new DirectoryDialog(shell);
    dlg.setFilterPath("C:/");

    String selectedDirectory = dlg.open();

    System.out.println(selectedDirectory);

    display.dispose();// w  w w  .j  av  a 2  s  . c  om

}

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 ww  . j ava 2  s  .c om
    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(250, 250);// w w w . j a  v a 2s.  c o  m
    s.setText("A Combo Example");
    final Combo c = new Combo(s, SWT.READ_ONLY);
    c.setBounds(50, 50, 150, 65);
    String items[] = { "Item One", "Item Two", "Item Three", "Item Four", "Item Five" };
    c.setItems(items);
    s.open();
    while (!s.isDisposed()) {
        if (!d.readAndDispatch())
            d.sleep();
    }
    d.dispose();
}

From source file:MainClass.java

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

    DirectoryDialog dlg = new DirectoryDialog(shell);

    dlg.setFilterPath("c:/");

    dlg.setText("SWT's DirectoryDialog");

    dlg.setMessage("Select a directory");

    String dir = dlg.open();//from  ww  w. j  a v a 2s. co m
    if (dir != null) {
        System.out.println(dir);
    }

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

From source file:DirectoryDialogTextMessage.java

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

    DirectoryDialog dlg = new DirectoryDialog(shell);
    dlg.setText("My Text");
    dlg.setMessage("My Message");
    String selectedDirectory = dlg.open();

    System.out.println(selectedDirectory);

    display.dispose();//from  w ww  .ja v  a2 s  .  c  o m

}

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  w w.j  ava  2s  . c o  m*/

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

    display.dispose();
}

From source file:LinkCreate.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 href=\"htpp://www.java2s.com\">link</A> widget.");
    link.setSize(140, 40);//from   w  ww.  j ava 2s  .  c  o m
    shell.pack();
    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.setSize(250, 250);// www  .  j  a v a 2 s  . co  m
    s.setText("A Combo Example");

    s.setText("A List Example");
    String items[] = { "Item One", "Item Two", "Item Three", "Item Four", "Item Five" };
    final List l = new List(s, SWT.SINGLE | SWT.BORDER);
    l.setBounds(50, 50, 75, 75);
    l.setItems(items);

    s.open();
    while (!s.isDisposed()) {
        if (!d.readAndDispatch())
            d.sleep();
    }
    d.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);/* w w w  .j ava  2  s . co  m*/
    s.open();
    DialogExample cs = new DialogExample(s);
    cs.open();

}

From source file:DirectoryDialogGetSelectedDirectory.java

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

    DirectoryDialog dlg = new DirectoryDialog(shell);
    String selectedDirectory = dlg.open();

    System.out.println(selectedDirectory);

    display.dispose();/*  w  ww.ja v  a 2s . co  m*/

}