List of usage examples for org.eclipse.swt.widgets Display sleep
public boolean sleep()
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"); }//from ww w. j a va2 s. co 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); }/* w w w .jav a2 s .co 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 . j a va 2 s. c o m*/ bar.pack(); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:LabelWithBorder.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display, SWT.SHELL_TRIM); shell.setLayout(new RowLayout()); Label label = new Label(shell, SWT.BORDER); label.setText("text on the label"); shell.open();//ww w . j ava 2 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:Snippet93.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new RowLayout()); Label label = new Label(shell, SWT.NONE); GC gc = new GC(label); Point size = gc.textExtent("Hello"); gc.dispose();/* w w w . j ava 2 s . c o m*/ label.setText("Hello -> " + size); 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);//from w w w. ja v a2s. c om shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:ButtonBasics.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display, SWT.SHELL_TRIM); shell.setLayout(new RowLayout()); Button button = new Button(shell, SWT.RIGHT); button.setText("text on the button"); shell.open();// w ww. j a v a 2 s. co m // 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:WidgetDisposeListener.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { System.out.println(e.widget + " disposed"); }//from ww w . j a v a 2s .c o m }); shell.setSize(260, 120); shell.open(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } }
From source file:ButtonTextAlignment.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"); shell.open();/*from ww w. ja va 2s . 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:EscapeMnemonicCharacter.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display, SWT.SHELL_TRIM); shell.setLayout(new RowLayout()); Button button = new Button(shell, SWT.RIGHT); button.setText("&&text on the button"); shell.open();//from ww w. j av a2 s . co m // Set up the event loop. while (!shell.isDisposed()) { if (!display.readAndDispatch()) { // If no more entries in event queue display.sleep(); } } display.dispose(); }