List of usage examples for org.eclipse.swt.widgets Display readAndDispatch
public boolean readAndDispatch()
true
if there is potentially more work to do, or false
if the caller can sleep until another event is placed on the event queue. From source file:TimerOneShot2000.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setSize(200, 200);// ww w .j a v a 2 s .c o m shell.open(); display.timerExec(2000, new Runnable() { public void run() { System.out.println("2000"); } }); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:StyledTextWordWrap.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); StyledText text1 = new StyledText(shell, SWT.V_SCROLL | SWT.BORDER); text1.setWordWrap(!text1.getWordWrap()); text1.setBounds(10, 10, 100, 100);// w w w .ja v a 2 s .c om shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:SeparatorHorizontalVertical.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL); new Label(shell, SWT.SEPARATOR | SWT.VERTICAL); shell.setSize(200, 200);//from w ww . j av a 2s .c o m shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:org.eclipse.swt.snippets.Snippet13.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Snippet 13"); shell.addListener(SWT.Paint, e -> { e.gc.setLineWidth(4);//from w w w .j av a 2s. com e.gc.drawRectangle(20, 20, 100, 100); }); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:ComboReadOnlyCreate.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); // Create a read-only Combo Combo readOnly = new Combo(shell, SWT.DROP_DOWN | SWT.READ_ONLY); readOnly.setItems(ITEMS);/*from w ww .j a va 2 s . co m*/ shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:LinkCreate.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); Link link = new Link(shell, SWT.BORDER); link.setText("This a very simple <A href=\"htpp://www.java2s.com\">link</A> widget."); link.setSize(140, 40);/*from www .j a va 2 s. c o m*/ shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:TextAppendLine.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); Text text = new Text(shell, SWT.BORDER | SWT.V_SCROLL); text.setBounds(10, 10, 100, 100);/*from w ww. j a v a 2 s . c o m*/ for (int i = 0; i < 16; i++) { text.append("Line " + i + "\n"); } shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:ToolItemToolTip.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); ToolBar bar = new ToolBar(shell, SWT.BORDER); bar.setBounds(0, 20, 200, 64);/*from ww w.ja v a 2 s.c om*/ ToolItem item1 = new ToolItem(bar, 0); item1.setToolTipText("ToolItem \n toolTip"); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:TabItemToolTip.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); TabFolder folder = new TabFolder(shell, SWT.BORDER); folder.setSize(200, 200);/* w w w .j a v a2s . co m*/ TabItem item0 = new TabItem(folder, 0); item0.setToolTipText("TabItem \n toolTip"); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:Snippet50.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Shell"); shell.setSize(200, 200);// w w w . ja va 2s .c o m shell.open(); Shell dialog = new Shell(shell); dialog.setText("Dialog"); dialog.setSize(200, 200); dialog.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }