List of usage examples for org.eclipse.swt.widgets Display dispose
public void 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 . jav a 2 s.c om 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:ListCreateAddItemsToIt.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); // Create a List with a vertical ScrollBar List list = new List(shell, SWT.V_SCROLL); // Add a bunch of items to it for (int i = 0; i < 500; i++) { list.add("A list item"); }// ww w . j a v a2 s . c o m shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:org.eclipse.swt.snippets.Snippet370.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Snippet 370"); shell.setLayout(new RowLayout(SWT.VERTICAL)); Locale[] locales = Locale.getAvailableLocales(); for (Locale locale : locales) { createForLocale(shell, locale);//w ww . ja v a 2s .c o m } shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:org.eclipse.swt.snippets.Snippet23.java
public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); shell.setText("Snippet 23"); shell.open();//from ww w . jav a2s. c o m shell.addListener(SWT.MouseDown, e -> { Tracker tracker = new Tracker(shell, SWT.NONE); tracker.setRectangles(new Rectangle[] { new Rectangle(e.x, e.y, 100, 100), }); tracker.open(); }); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:GCBackgroundForeground.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.open();//w ww.j a va 2 s .co m Color white = display.getSystemColor(SWT.COLOR_WHITE); Color black = display.getSystemColor(SWT.COLOR_BLACK); GC gc = new GC(shell); gc.setBackground(black); gc.setForeground(white); gc.drawString("Test", 12, 12); gc.dispose(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:RadioButtonExample.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout(3, true)); // Create three radio buttons new Button(shell, SWT.RADIO).setText("Radio 1"); new Button(shell, SWT.RADIO).setText("Radio 2"); new Button(shell, SWT.RADIO).setText("Radio 3"); shell.pack();/*from w w w. ja va 2s. c o m*/ shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:CLabelRightShadowNone.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("CLabel Test"); shell.setLayout(new GridLayout(1, false)); CLabel right = new CLabel(shell, SWT.RIGHT | SWT.SHADOW_NONE); right.setText("Right and Shadow None"); right.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); shell.open();//from ww w . j ava 2 s .c o m while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:org.eclipse.swt.snippets.Snippet26.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Snippet 26"); Combo combo = new Combo(shell, SWT.READ_ONLY); combo.setItems("Alpha", "Bravo", "Charlie"); Rectangle clientArea = shell.getClientArea(); combo.setBounds(clientArea.x, clientArea.y, 200, 200); shell.pack();/* w w w.j a v a2 s . c o m*/ shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:CLabelCenterShadowOut.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("CLabel Test"); shell.setLayout(new GridLayout(1, false)); CLabel center = new CLabel(shell, SWT.CENTER | SWT.SHADOW_OUT); center.setText("Center and Shadow Out"); center.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); shell.open();/*from w w w. j av a2 s . c o m*/ while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:org.eclipse.swt.snippets.Snippet307.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Snippet 307"); shell.setLayout(new FillLayout()); shell.setBounds(10, 10, 300, 200);/*from w w w . j av a 2 s . c o m*/ final Browser browser; try { browser = new Browser(shell, SWT.NONE); } catch (SWTError e) { System.out.println("Could not instantiate Browser: " + e.getMessage()); display.dispose(); return; } browser.setText(createHTML()); final BrowserFunction function = new CustomFunction(browser, "theJavaFunction"); browser.addProgressListener(ProgressListener.completedAdapter(event -> { browser.addLocationListener(new LocationAdapter() { @Override public void changed(LocationEvent event) { browser.removeLocationListener(this); System.out.println("left java function-aware page, so disposed CustomFunction"); function.dispose(); } }); })); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }