comparison snippets/button/Snippet206.d @ 117:8cdaac0dc743

Added more snippets from TomD
author Frank Benoit <benoit@tionex.de>
date Sat, 12 Jul 2008 20:09:06 +0200
parents 0de3dab4d6e1
children
comparison
equal deleted inserted replaced
116:f53c6274734f 117:8cdaac0dc743
18 * For a list of all SWT example snippets see 18 * For a list of all SWT example snippets see
19 * http://www.eclipse.org/swt/snippets/ 19 * http://www.eclipse.org/swt/snippets/
20 * 20 *
21 * @since 3.2 21 * @since 3.2
22 */ 22 */
23 /* Port OK */
24 23
25 import dwt.DWT; 24 import dwt.DWT;
26 import dwt.graphics.Image; 25 import dwt.graphics.Image;
27 import dwt.layout.GridLayout; 26 import dwt.layout.GridLayout;
28 import dwt.widgets.Button; 27 import dwt.widgets.Button;
30 import dwt.widgets.Shell; 29 import dwt.widgets.Shell;
31 30
32 import dwt.dwthelper.utils; 31 import dwt.dwthelper.utils;
33 32
34 void main(String[] args){ 33 void main(String[] args){
35 Snippet206.main(args); 34 Snippet206.main(args);
36 } 35 }
37 36
38 public class Snippet206 { 37 public class Snippet206 {
39 public static void main(String[] args) { 38 public static void main(String[] args) {
40 Display display = new Display(); 39 Display display = new Display();
41 Image image = display.getSystemImage(DWT.ICON_QUESTION); 40 Image image = display.getSystemImage(DWT.ICON_QUESTION);
42 Shell shell = new Shell(display); 41 Shell shell = new Shell(display);
43 shell.setLayout (new GridLayout()); 42 shell.setLayout (new GridLayout());
44 Button button = new Button(shell, DWT.PUSH); 43 Button button = new Button(shell, DWT.PUSH);
45 button.setImage(image); 44 button.setImage(image);
46 button.setText("Button"); 45 button.setText("Button");
47 shell.setSize(300, 300); 46 shell.setSize(300, 300);
48 shell.open(); 47 shell.open();
49 while (!shell.isDisposed ()) { 48 while (!shell.isDisposed ()) {
50 if (!display.readAndDispatch ()) display.sleep (); 49 if (!display.readAndDispatch ()) display.sleep ();
50 }
51 display.dispose ();
51 } 52 }
52 display.dispose ();
53 }
54 } 53 }