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

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

    // Create three checkboxes
    new Button(shell, SWT.CHECK).setText("Checkbox 1");
    new Button(shell, SWT.CHECK).setText("Checkbox 2");
    new Button(shell, SWT.CHECK).setText("Checkbox 3");

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

From source file:ThickLinkDraw.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.open();/*ww w.ja v  a  2 s.  c  om*/
    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:DrawLine.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.open();//from  w w  w.  j  ava2  s.c om

    GC gc = new GC(shell);

    gc.drawLine(0, 0, 19, 19);
    gc.drawLine(19, 0, 0, 19);

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

    display.dispose();
}

From source file:DeviceDPI.java

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

    Device device = shell.getDisplay();//  w ww  .j  av  a2 s  . c  om

    System.out.println("getDepth(): " + device.getDepth());
    System.out.println("getDPI(): " + device.getDPI());

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

}

From source file:PrintWarning.java

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

    Device device = shell.getDisplay();//from w ww.j a v a 2 s.  c om

    // By setting warnings to true and then getting warnings, we know if the
    // current platform supports it
    device.setWarnings(true);
    System.out.println("Warnings supported: " + device.getWarnings());

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

}

From source file:ShellSmallImage.java

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

    Image small = new Image(display, "yourFile.gif");

    shell.setImage(small);//from   w  ww. ja  v a 2  s.co  m

    shell.open();

    // Set up the event loop.
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            // If no more entries in event queue
            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);/*from  www  .  j av a  2  s .  c o m*/
    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();
}

From source file:MainClass.java

public static void main(String[] a) {
    Display d = new Display();
    Shell s = new Shell(d);

    s.setSize(250, 250);//  ww w .  jav a2s  .  c om
    s.setText("A Text Example");
    final Text text1 = new Text(s, SWT.SINGLE | SWT.BORDER);
    text1.setBounds(10, 10, 100, 20);

    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(250, 250);// w w  w.j  a va  2 s . c o  m
    s.setText("A Text Example");
    Text text1 = new Text(s, SWT.MULTI | SWT.BORDER);
    text1.setBounds(0, 0, 250, 250);

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

From source file:DeviceDisplayBoundary.java

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

    Device device = shell.getDisplay();//from w w w.j av  a  2s .c om

    System.out.println("getBounds(): " + device.getBounds());
    System.out.println("getClientArea(): " + device.getClientArea());

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

}