List of usage examples for org.eclipse.swt.widgets Display sleep
public boolean sleep()
From source file:ShellWindowCloseEvent.java
public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); shell.addListener(SWT.Close, new Listener() { public void handleEvent(Event event) { System.out.println("cose"); }// w ww . j a v a 2 s . c om }); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:CaretImage.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.open();//from ww w . j a va2 s . c o m Caret caret = new Caret(shell, SWT.NONE); Image image = new Image(display, "yourFile.gif"); caret.setLocation(10, 10); caret.setImage(image); caret.setVisible(true); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:FillLayoutVERTICAL.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout(SWT.VERTICAL)); new Button(shell, SWT.PUSH).setText("one"); new Button(shell, SWT.PUSH).setText("two"); new Button(shell, SWT.PUSH).setText("three"); shell.open();//from www. j av a 2s . c o m while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:org.eclipse.swt.snippets.Snippet121.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Snippet 121"); shell.setLayout(new FillLayout()); Text text = new Text(shell, SWT.SINGLE | SWT.BORDER); text.setEchoChar('*'); shell.pack();//www.j a v a 2 s . c o m shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:FillLayoutHorizontal.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new FillLayout(SWT.HORIZONTAL)); new Button(shell, SWT.PUSH).setText("one"); new Button(shell, SWT.PUSH).setText("two"); new Button(shell, SWT.PUSH).setText("three"); shell.open();/*from w ww. jav a 2 s .c om*/ while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:org.eclipse.swt.snippets.Snippet60.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Snippet 60"); shell.setSize(200, 200);/* w ww .ja va2s . c om*/ shell.open(); display.timerExec(5000, () -> System.out.println("5000")); display.timerExec(2000, () -> System.out.println("2000")); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:StyledTextTabSize.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.setTabs(2);/*w ww .j a va2 s . c o m*/ styledText.setBounds(10, 10, 100, 100); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:StyledTextPrint.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.print();//from www . j a v a 2 s . c om styledText.setBounds(10, 10, 100, 100); shell.open(); 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(); Shell shell = new Shell(display); shell.setText("Sash One"); shell.setLayout(new FillLayout()); new Text(shell, SWT.BORDER); new Sash(shell, SWT.VERTICAL); new Text(shell, SWT.BORDER); shell.pack();//from w ww. ja va 2 s . c o m shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:FirstSWTClass.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("First SWT Application"); shell.setSize(250, 250);/*from w w w.j a va 2 s. c o m*/ Label label = new Label(shell, SWT.CENTER); label.setText("Greetings from SWT"); label.setBounds(shell.getClientArea()); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }