List of usage examples for org.eclipse.swt.widgets Display dispose
public void dispose()
From source file:TableCheckBoxCell.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); Table table = new Table(shell, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); for (int i = 0; i < 12; i++) { TableItem item = new TableItem(table, SWT.NONE); item.setText("Item " + i); }/* w w w . java 2 s . c o m*/ table.setSize(100, 100); shell.setSize(200, 200); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:org.eclipse.swt.snippets.Snippet14.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Snippet 14"); shell.setSize(100, 100);/*ww w . ja v a 2s. c o m*/ shell.addListener(SWT.MouseEnter, e -> System.out.println("ENTER")); shell.addListener(SWT.MouseExit, e -> System.out.println("EXIT")); shell.addListener(SWT.MouseHover, e -> System.out.println("HOVER")); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:org.eclipse.swt.snippets.Snippet93.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Snippet 93"); shell.setLayout(new RowLayout()); Label label = new Label(shell, SWT.NONE); GC gc = new GC(label); Point size = gc.textExtent("Hello"); gc.dispose();/*w w w . j a v a 2 s . c om*/ label.setText("Hello -> " + size); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:SelectRangeList.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); // Create a multiple-selection list List multi = new List(shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL); // Add the items all at once multi.setItems(ITEMS);/*from w ww. j a v a 2 s . co m*/ // Select a range multi.select(0, 2); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:org.eclipse.swt.snippets.Snippet206.java
public static void main(String[] args) { Display display = new Display(); Image image = display.getSystemImage(SWT.ICON_QUESTION); Shell shell = new Shell(display); shell.setText("Snippet 206"); shell.setLayout(new GridLayout()); Button button = new Button(shell, SWT.PUSH); button.setImage(image);//from ww w.j av a2s . c o m button.setText("Button"); shell.setSize(300, 300); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:DrawOval.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.addPaintListener(new PaintListener() { public void paintControl(PaintEvent event) { Rectangle rect = shell.getClientArea(); event.gc.drawOval(0, 0, rect.width - 1, rect.height - 1); }//from w w w .ja v a 2s . co m }); shell.setBounds(10, 10, 200, 200); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:org.eclipse.swt.snippets.Snippet19.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Snippet 19"); Text text = new Text(shell, SWT.BORDER | SWT.V_SCROLL); Rectangle clientArea = shell.getClientArea(); text.setBounds(clientArea.x + 10, clientArea.y + 10, 200, 200); text.addVerifyListener(Snippet19::ensureTextContainsOnlyDigits); shell.open();//from ww w.ja va 2 s . c o m while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:ButtonAlignment.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display, SWT.SHELL_TRIM); shell.setLayout(new FillLayout()); Button button = new Button(shell, SWT.RIGHT); button.setText("text on the button"); button.setAlignment(SWT.CENTER);//from www. j a v a 2s .c o 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:org.eclipse.swt.snippets.Snippet173.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Main Window"); shell.setLayout(new FillLayout()); Browser browser = new Browser(shell, SWT.NONE); initialize(display, browser);/*w w w .java 2 s . c om*/ shell.open(); /* any website with popups */ browser.setUrl("http://www.cnn.com"); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:CreateMultipleSelectionList.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); // Create a multiple-selection list List multi = new List(shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL); // Add the items, one by one for (int i = 0, n = ITEMS.length; i < n; i++) { multi.add(ITEMS[i]);// w w w. j a va 2s .c o m } shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }