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:ToolBarVertical.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); ToolBar bar = new ToolBar(shell, SWT.BORDER | SWT.VERTICAL); for (int i = 0; i < 4; i++) { ToolItem item = new ToolItem(bar, 0); item.setText("Item " + i); }/* ww w .j a v a 2 s . c om*/ bar.pack(); shell.pack(); shell.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);/*from ww w. j a va2 s .c o m*/ s.setText("A Combo Example"); final Combo c = new Combo(s, SWT.READ_ONLY); c.setBounds(50, 50, 150, 65); String items[] = { "Item One", "Item Two", "Item Three", "Item Four", "Item Five" }; c.setItems(items); s.open(); while (!s.isDisposed()) { if (!d.readAndDispatch()) d.sleep(); } d.dispose(); }
From source file:StyledTextSetKeyBinding.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"); styledText.setKeyBinding('i' | SWT.ALT, ST.TOGGLE_OVERWRITE); styledText.setBounds(10, 10, 100, 100); shell.open();//www . j av a2 s. c o m while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:DialogShellPositionIt.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); Shell dialog = new Shell(shell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); Point pt = display.getCursorLocation(); dialog.setLocation(pt.x, pt.y);//from w w w.j a v a 2 s .c o m dialog.setText("Dialog Shell"); dialog.setSize(100, 100); dialog.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:ButtonAlignment.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display, SWT.SHELL_TRIM); shell.setLayout(new FillLayout()); Button button = new Button(shell, SWT.RIGHT); button.setText("text on the button"); button.setAlignment(SWT.CENTER);/*from w ww.ja va 2 s .c o m*/ shell.open(); // Set up the event loop. while (!shell.isDisposed()) { if (!display.readAndDispatch()) { // If no more entries in event queue display.sleep(); } } display.dispose(); }
From source file:ToolItemButtonPush.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); ToolBar bar = new ToolBar(shell, SWT.BORDER | SWT.VERTICAL); for (int i = 0; i < 4; i++) { ToolItem item = new ToolItem(bar, SWT.PUSH); item.setText("Item " + i); }//from w w w. ja v a2 s. c o m bar.pack(); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:ToolItemDropDown.java
License:asdf
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); ToolBar bar = new ToolBar(shell, SWT.BORDER | SWT.VERTICAL); for (int i = 0; i < 4; i++) { ToolItem item = new ToolItem(bar, SWT.DROP_DOWN); item.setText("asdf"); }/* w w w.ja v a2 s. c o m*/ bar.pack(); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:ToolItemCheckBox.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); ToolBar bar = new ToolBar(shell, SWT.BORDER | SWT.VERTICAL); for (int i = 0; i < 4; i++) { ToolItem item = new ToolItem(bar, SWT.CHECK); item.setText("Item " + i); }/*from w w w .j a v a 2 s . c o m*/ bar.pack(); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:ToolItemRadioButton.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); ToolBar bar = new ToolBar(shell, SWT.BORDER | SWT.VERTICAL); for (int i = 0; i < 4; i++) { ToolItem item = new ToolItem(bar, SWT.RADIO); item.setText("Item " + i); }/* w w w. jav a 2 s . com*/ bar.pack(); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:LayoutDataControlLayout.java
public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); shell.setLayout(new GridLayout()); // Only with GridLayout you can use GridData Text text = new Text(shell, SWT.SINGLE | SWT.BORDER); text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL)); shell.setSize(450, 100);/* www .j a va 2 s . c o m*/ shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }