List of usage examples for org.eclipse.swt.widgets Display sleep
public boolean sleep()
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);//from 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:InputDialog.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); InputDialog dlg = new InputDialog(shell); String input = dlg.open();/*from www. ja va 2s . c o m*/ if (input != null) { // User clicked OK; set the text into the label System.out.println(input); } 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();//from w w w .j a va 2 s . com 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: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 w w w . j a v a 2 s. co 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:MainClass.java
public static void main(String[] a) { Display d = new Display(); Shell s = new Shell(d); s.setSize(250, 250);// ww w.j a va 2 s. c o 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: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();//from w w w. jav a2s .c o m 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);// w ww . ja v a2s . co m // Select a range multi.select(0, 2); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:ProgressBarUpdateUIThread.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); ProgressBar bar = new ProgressBar(shell, SWT.SMOOTH); bar.setBounds(10, 10, 200, 32);/*from w ww . j av a 2s . com*/ shell.open(); for (int i = 0; i <= bar.getMaximum(); i++) { try { Thread.sleep(100); } catch (Throwable th) { } bar.setSelection(i); } while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:TableScrollSelection.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); Table table = new Table(shell, SWT.BORDER | SWT.MULTI); table.setSize(200, 200);// ww w .j av a 2 s . co m for (int i = 0; i < 128; i++) { TableItem item = new TableItem(table, SWT.NONE); item.setText("Item " + i); } table.setSelection(95); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:Flowchart.java
public static void main(String args[]) { Shell shell = new Shell(); shell.setSize(200, 300);/* ww w. j a v a 2 s . co m*/ shell.open(); shell.setText("Flowchart"); LightweightSystem lws = new LightweightSystem(shell); ChartFigure flowchart = new ChartFigure(); lws.setContents(flowchart); TerminatorFigure start = new TerminatorFigure(); start.setName("Start"); start.setBounds(new Rectangle(40, 20, 80, 20)); DecisionFigure dec = new DecisionFigure(); dec.setName("Should I?"); dec.setBounds(new Rectangle(30, 60, 100, 60)); ProcessFigure proc = new ProcessFigure(); proc.setName("Do it!"); proc.setBounds(new Rectangle(40, 140, 80, 40)); TerminatorFigure stop = new TerminatorFigure(); stop.setName("End"); stop.setBounds(new Rectangle(40, 200, 80, 20)); PathFigure path1 = new PathFigure(); path1.setSourceAnchor(start.outAnchor); path1.setTargetAnchor(dec.inAnchor); PathFigure path2 = new PathFigure(); path2.setSourceAnchor(dec.yesAnchor); path2.setTargetAnchor(proc.inAnchor); PathFigure path3 = new PathFigure(); path3.setSourceAnchor(dec.noAnchor); path3.setTargetAnchor(stop.inAnchor); PathFigure path4 = new PathFigure(); path4.setSourceAnchor(proc.outAnchor); path4.setTargetAnchor(stop.inAnchor); flowchart.add(start); flowchart.add(dec); flowchart.add(proc); flowchart.add(stop); flowchart.add(path1); flowchart.add(path2); flowchart.add(path3); flowchart.add(path4); new Dnd(start); new Dnd(proc); new Dnd(dec); new Dnd(stop); Display display = Display.getDefault(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } }