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:Snippet18.java
public static void main(String[] args) { Shell shell = new Shell(); ToolBar bar = new ToolBar(shell, SWT.BORDER); for (int i = 0; i < 8; i++) { ToolItem item = new ToolItem(bar, SWT.PUSH); item.setText("Item " + i); }/*from ww w . j a v a2 s. c om*/ bar.pack(); shell.open(); Display display = shell.getDisplay(); 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(500, 500);/*from ww w . j av a 2s.c o m*/ s.open(); while (!s.isDisposed()) { if (!d.readAndDispatch()) d.sleep(); } d.dispose(); }
From source file:HelloWorld4.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new HelloWorld4().open(display); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep();/*from w w w .j a va 2 s . c o m*/ } display.dispose(); }
From source file:org.eclipse.swt.examples.helloworld.HelloWorld1.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new HelloWorld1().open(display); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep();/*from ww w.ja v a2 s. co m*/ } display.dispose(); }
From source file:HelloWorld3.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new HelloWorld3().open(display); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep();/* ww w . j a v a 2 s . co m*/ } display.dispose(); }
From source file:org.eclipse.swt.examples.helloworld.HelloWorld2.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new HelloWorld2().open(display); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep();//w w w . ja v a 2 s. c o m } display.dispose(); }
From source file:HelloWorld5.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new HelloWorld5().open(display); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep();//from w w w . j a va 2 s.c o m } display.dispose(); }
From source file:Draw2D_Example.java
public static void main(String args[]) { final Label label = new Label("Press a button!"); Shell shell = new Shell(); LightweightSystem lws = new LightweightSystem(shell); Figure parent = new Figure(); parent.setLayoutManager(new XYLayout()); lws.setContents(parent);/*from ww w . j av a 2 s .c o m*/ Clickable above = new CheckBox("I'm above!"); parent.add(above, new Rectangle(10, 10, 80, 20)); ButtonModel aModel = new ToggleModel(); aModel.addChangeListener(new ChangeListener() { public void handleStateChanged(ChangeEvent e) { label.setText("Above"); } }); above.setModel(aModel); Clickable below = new CheckBox("I'm below!"); parent.add(below, new Rectangle(10, 40, 80, 20)); ButtonModel bModel = new ToggleModel(); bModel.addChangeListener(new ChangeListener() { public void handleStateChanged(ChangeEvent e) { label.setText("Below"); } }); below.setModel(bModel); ButtonGroup bGroup = new ButtonGroup(); bGroup.add(aModel); bGroup.add(bModel); bGroup.setDefault(bModel); parent.add(label, new Rectangle(10, 70, 80, 20)); shell.setSize(130, 120); shell.open(); shell.setText("Example"); Display display = Display.getDefault(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } }
From source file:MainClass.java
public static void main(String[] a) { Display d = new Display(); Shell s = new Shell(d, SWT.CLOSE | SWT.RESIZE); s.setSize(300, 300);/* w w w .jav a 2s.co m*/ s.open(); while (!s.isDisposed()) { if (!d.readAndDispatch()) d.sleep(); } d.dispose(); }
From source file:ShellMini.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setMinimized(true);/* ww w .ja v a2 s . co m*/ shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }