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

public static void main(String[] a) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setText("Sash One");

    // The SWT.BORDER style
    Decorations d = new Decorations(shell, SWT.NO_TRIM);
    d.setLayoutData(new GridData(GridData.FILL_BOTH));
    d.setLayout(new FillLayout());
    Label l = new Label(d, SWT.CENTER);
    l.setText("SWT.NO_TRIM");

    d.setBounds(20, 20, 100, 100);//from   ww w  .ja v a 2 s  .  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 display = new Display();
    Shell shell = new Shell(display);
    shell.setText("Sash One");

    // The SWT.BORDER style
    Decorations d = new Decorations(shell, SWT.MAX);
    d.setLayoutData(new GridData(GridData.FILL_BOTH));
    d.setLayout(new FillLayout());
    Label l = new Label(d, SWT.CENTER);
    l.setText("SWT.MAX");

    d.setBounds(20, 20, 100, 100);//from w  w  w .  ja  v  a  2s. c om

    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 display = new Display();
    Shell shell = new Shell(display);
    shell.setText("Sash One");

    // The SWT.BORDER style
    Decorations d = new Decorations(shell, SWT.TOOL);
    d.setLayoutData(new GridData(GridData.FILL_BOTH));
    d.setLayout(new FillLayout());
    Label l = new Label(d, SWT.CENTER);
    l.setText("SWT.TOOL");

    d.setBounds(20, 20, 100, 100);/* w  ww .  j a va  2 s  . co  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 display = new Display();
    Shell shell = new Shell(display);
    shell.setText("Sash One");

    // The SWT.BORDER style
    Decorations d = new Decorations(shell, SWT.TITLE);
    d.setLayoutData(new GridData(GridData.FILL_BOTH));
    d.setLayout(new FillLayout());
    Label l = new Label(d, SWT.CENTER);
    l.setText("SWT.TITLE");

    d.setBounds(20, 20, 100, 100);/* w w w  .  j a  va  2s. co 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 display = new Display();
    Shell shell = new Shell(display);
    shell.setText("Sash One");

    // The SWT.BORDER style
    Decorations d = new Decorations(shell, SWT.CLOSE);
    d.setLayoutData(new GridData(GridData.FILL_BOTH));
    d.setLayout(new FillLayout());
    Label l = new Label(d, SWT.CENTER);
    l.setText("SWT.CLOSE");

    d.setBounds(20, 20, 100, 100);/* w w  w  . j a v  a2 s . co  m*/

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

From source file:StyledTextVerifyKeyListener.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.addVerifyKeyListener(new VerifyKeyListener() {

        public void verifyKey(VerifyEvent e) {
            System.out.println(e.character);
            e.doit = false;/*  ww  w.  j a va  2  s  .co m*/

        }
    });

    styledText.setBounds(10, 10, 100, 100);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    display.dispose();

}

From source file:DisposeListenerWithShell.java

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

    // Create the child shell and the dispose listener
    final Shell childShell = new Shell(shell);
    childShell.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent event) {
            // When the child shell is disposed, change the message on the main shell
            System.out.println("Dispoase");
        }//from w  w  w.  j a v  a  2 s  .  co m
    });
    childShell.setLayout(new FillLayout());
    childShell.setText("little brother");
    childShell.open();

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

From source file:StyledTextVerifyListenerStopPasting.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.addVerifyListener(new VerifyListener() {
        public void verifyText(VerifyEvent event) {
            if (event.text.length() > 1) {
                event.text = "Stop pasting!";
            }/*ww w.  ja  v a 2s.co m*/

        }
    });

    styledText.setBounds(10, 10, 100, 100);
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    display.dispose();
}

From source file:Snippet28.java

public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setMaximized(true);//from   w  ww.  j  a v a 2  s.  c  om
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch())
            display.sleep();
    }
    display.dispose();
}

From source file:GroupShadowCreate.java

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

    // Create the first Group
    Group group1 = new Group(shell, SWT.SHADOW_IN);
    group1.setText("Who's your favorite?");
    group1.setLayout(new RowLayout(SWT.VERTICAL));
    new Button(group1, SWT.RADIO).setText("A");
    new Button(group1, SWT.RADIO).setText("B");
    new Button(group1, SWT.RADIO).setText("C");
    new Button(group1, SWT.RADIO).setText("D");

    shell.open();/*w w w.  j  ava  2  s  .  c  om*/
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    display.dispose();
}