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:ButtonImageAdd.java
public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); Image image = new Image(display, "yourFile.gif"); Button button = new Button(shell, SWT.PUSH); button.setImage(image);//from ww w . j a va 2s. c o m button.setText("button"); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } }
From source file:SettingItemsAddItemAtOnce.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 av a 2 s . c om*/ shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:org.eclipse.swt.snippets.Snippet37.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Snippet 37"); shell.setLayout(new FillLayout()); new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL); new Label(shell, SWT.SEPARATOR | SWT.VERTICAL); shell.setSize(200, 200);/*w w w.j a v a2s. c o m*/ shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:ProgressBarExample.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout()); // Create an indeterminate ProgressBar ProgressBar pb2 = new ProgressBar(shell, SWT.HORIZONTAL | SWT.INDETERMINATE); pb2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); shell.open();//from www . jav a 2s . c o m while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } }
From source file:MainClass.java
public static void main(String[] a) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout()); // Create an indeterminate progress bar ProgressBar pb2 = new ProgressBar(shell, SWT.HORIZONTAL | SWT.INDETERMINATE); pb2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); shell.open();/*from ww w . ja v a 2 s.c om*/ 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); s.setSize(250, 250);/*from w ww . j a v a 2s.c o m*/ s.setText("A ProgressBar Example"); final ProgressBar pb = new ProgressBar(s, SWT.HORIZONTAL); pb.setMinimum(0); pb.setMaximum(100); pb.setSelection(50); pb.setBounds(10, 10, 200, 20); s.open(); while (!s.isDisposed()) { if (!d.readAndDispatch()) d.sleep(); } d.dispose(); }
From source file:org.eclipse.swt.snippets.Snippet346.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); shell.setText("Snippet 346"); Text text = new Text(shell, SWT.PASSWORD | SWT.BORDER); text.setTextChars(new char[] { 'p', 'a', 's', 's' }); shell.pack();/*w ww .j ava2s. co m*/ shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:org.eclipse.swt.examples.controlexample.CustomControlExample.java
/** * Invokes as a standalone program.//w w w .ja v a2 s . com */ public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); CustomControlExample instance = new CustomControlExample(shell); shell.setText(getResourceString("custom.window.title")); setShellSize(instance, shell); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } instance.dispose(); }
From source file:ArrowButtonExample.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout(3, true)); // Create three arrow buttons new Button(shell, SWT.ARROW); new Button(shell, SWT.ARROW | SWT.LEFT); new Button(shell, SWT.ARROW | SWT.DOWN); shell.pack();/*from w w w .j av a 2 s.c o m*/ shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:StyledTextActionBound.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); StyledText styledText = new StyledText(shell, SWT.V_SCROLL | SWT.BORDER); styledText.setText("12345"); int altEAction = styledText.getKeyBinding('e' | SWT.ALT); styledText.setBounds(10, 10, 100, 100); shell.open();//from w w w. j av a 2 s. c o m while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }