List of usage examples for org.eclipse.swt.widgets Display sleep
public boolean sleep()
From source file:StyledTextActionBoundArrowShift.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 shiftLeftAction = styledText.getKeyBinding(SWT.ARROW_LEFT | SWT.SHIFT); styledText.setBounds(10, 10, 100, 100); shell.open();// ww w .j a v a 2s .c o m while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:PrintWarning.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); Device device = shell.getDisplay();// ww w.j ava 2 s . co m // By setting warnings to true and then getting warnings, we know if the // current platform supports it device.setWarnings(true); System.out.println("Warnings supported: " + device.getWarnings()); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:LabelTextImageAlignment.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()); Label label = new Label(shell, SWT.BORDER | SWT.RIGHT); label.setText("text on the label"); shell.open();/* www. ja v a 2 s . c om*/ // 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:LabelShadowInOut.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()); Label label = new Label(shell, SWT.BORDER | SWT.SHADOW_OUT); label.setText("text on the label"); shell.open();/* ww w.ja va2 s.com*/ // 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:CLabelLeftShadowIn.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("CLabel Test"); shell.setLayout(new GridLayout(1, false)); CLabel left = new CLabel(shell, SWT.LEFT | SWT.SHADOW_IN); left.setText("Left and Shadow In"); left.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); shell.open();//from w ww .j a va 2s . c o m while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:PushButtonExample.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout(3, true)); // Create three push buttons new Button(shell, SWT.PUSH).setText("Push 1"); new Button(shell, SWT.PUSH).setText("Push 2"); new Button(shell, SWT.PUSH).setText("Push 3"); shell.pack();/* ww w. j ava2 s. co m*/ shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:ShellResizeEvent.java
public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display, SWT.SHELL_TRIM | SWT.H_SCROLL | SWT.V_SCROLL); shell.addListener(SWT.Resize, new Listener() { public void handleEvent(Event e) { Rectangle rect = shell.getClientArea(); System.out.println(rect); }//w w w .ja v a2 s. co m }); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:ListCreateAddItemsToIt.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); // Create a List with a vertical ScrollBar List list = new List(shell, SWT.V_SCROLL); // Add a bunch of items to it for (int i = 0; i < 500; i++) { list.add("A list item"); }/* w ww . j a v a 2s. c o m*/ shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:Snippet184.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); Spinner spinner = new Spinner(shell, SWT.BORDER); spinner.setMinimum(0);/* w ww .j av a2 s . co m*/ spinner.setMaximum(1000); spinner.setSelection(500); spinner.setIncrement(1); spinner.setPageIncrement(100); spinner.pack(); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:org.eclipse.swt.snippets.Snippet33.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Snippet 33"); shell.open();/*from w w w .ja va 2 s . c o m*/ DirectoryDialog dialog = new DirectoryDialog(shell); String platform = SWT.getPlatform(); dialog.setFilterPath(platform.equals("win32") ? "c:\\" : "/"); System.out.println("RESULT=" + dialog.open()); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }