List of usage examples for org.eclipse.swt.widgets Display sleep
public boolean sleep()
From source file:RadioButtonExample.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout(3, true)); // Create three radio buttons new Button(shell, SWT.RADIO).setText("Radio 1"); new Button(shell, SWT.RADIO).setText("Radio 2"); new Button(shell, SWT.RADIO).setText("Radio 3"); shell.pack();//from w w w . j a v a 2 s. co m shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:CLabelRightShadowNone.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 right = new CLabel(shell, SWT.RIGHT | SWT.SHADOW_NONE); right.setText("Right and Shadow None"); right.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); shell.open();/*from w w w . jav a2 s . c o m*/ while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:org.eclipse.swt.snippets.Snippet22.java
License:asdf
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Snippet 22"); Text text = new Text(shell, 0); text.setText("ASDF"); Rectangle clientArea = shell.getClientArea(); text.setBounds(clientArea.x, clientArea.y, 64, 32); text.selectAll();/*from w ww . ja va 2 s .co m*/ shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:org.eclipse.swt.snippets.Snippet45.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Snippet 45"); Scale scale = new Scale(shell, SWT.BORDER); Rectangle clientArea = shell.getClientArea(); scale.setBounds(clientArea.x, clientArea.y, 200, 64); scale.setMaximum(40);// ww w . j av a 2s.c o m scale.setPageIncrement(5); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:ControlSizeSetting.java
public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setSize(150, 150);// www. jav a2 s .c om final Cursor[] cursor = new Cursor[1]; Button button = new Button(shell, SWT.PUSH); button.setText("Change cursor"); Point size = button.computeSize(SWT.DEFAULT, SWT.DEFAULT); button.setSize(size); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } if (cursor[0] != null) cursor[0].dispose(); display.dispose(); }
From source file:CLabelCenterShadowOut.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 center = new CLabel(shell, SWT.CENTER | SWT.SHADOW_OUT); center.setText("Center and Shadow Out"); center.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); shell.open();/*w ww . j a v a 2 s . c om*/ while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:CheckBoxButtonExample.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout(3, true)); // Create three checkboxes new Button(shell, SWT.CHECK).setText("Checkbox 1"); new Button(shell, SWT.CHECK).setText("Checkbox 2"); new Button(shell, SWT.CHECK).setText("Checkbox 3"); shell.pack();/* w ww. j a va 2 s . c om*/ shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:ToggleButtonExample.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout(3, true)); // Create three toggle buttons new Button(shell, SWT.TOGGLE).setText("Toggle 1"); new Button(shell, SWT.TOGGLE).setText("Toggle 2"); new Button(shell, SWT.TOGGLE).setText("Toggle 3"); shell.pack();//from ww w .j av a2 s .c o m shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:Snippet12.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); Text text = new Text(shell, SWT.BORDER | SWT.V_SCROLL); text.setBounds(10, 10, 100, 100);//w ww.j a v a 2 s. co m for (int i = 0; i < 16; i++) { text.append("Line " + i + "\n"); } shell.open(); text.setSelection(30, 38); System.out.println(text.getCaretLocation()); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:MainClass.java
public static void main(String[] a) { Display display = new Display(); final Shell shell = new Shell(display); DirectoryDialog dlg = new DirectoryDialog(shell); dlg.setFilterPath("c:/"); dlg.setText("SWT's DirectoryDialog"); dlg.setMessage("Select a directory"); String dir = dlg.open();/*from w w w . j ava2 s .c om*/ if (dir != null) { System.out.println(dir); } while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }