Mercurial > projects > dwt2
comparison org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet169.d @ 112:9f4c18c268b2
Update to compile and execute with dmd 2.052.
author | kntroh |
---|---|
date | Wed, 16 Mar 2011 21:53:53 +0900 |
parents | 69b1fa94a4a8 |
children | 536e43f63c81 |
comparison
equal
deleted
inserted
replaced
111:b6e9904989ed | 112:9f4c18c268b2 |
---|---|
29 import org.eclipse.swt.widgets.Shell; | 29 import org.eclipse.swt.widgets.Shell; |
30 import org.eclipse.swt.widgets.Listener; | 30 import org.eclipse.swt.widgets.Listener; |
31 import org.eclipse.swt.layout.FillLayout; | 31 import org.eclipse.swt.layout.FillLayout; |
32 | 32 |
33 import java.lang.all; | 33 import java.lang.all; |
34 import tango.util.Convert; | 34 version(Tango){ |
35 import tango.util.Convert; | |
36 } else { // Phobos | |
37 import std.conv; | |
38 } | |
35 | 39 |
36 void main(String[] args){ | 40 void main(String[] args){ |
37 Snippet169.main(args); | 41 Snippet169.main(args); |
38 } | 42 } |
39 | 43 |
40 | 44 |
41 public class Snippet169 { | 45 public class Snippet169 { |
42 public static void main (String [] args) { | 46 public static void main (String [] args) { |
43 Display display = new Display (); | 47 Display display = new Display (); |
44 final Shell shell = new Shell (display); | 48 Shell shell = new Shell (display); |
45 shell.setLayout (new FillLayout ()); | 49 shell.setLayout (new FillLayout ()); |
46 Listener listener = new class() Listener { | 50 Listener listener = new class() Listener { |
47 public void handleEvent (Event e) { | 51 public void handleEvent (Event e) { |
48 Control [] children = shell.getChildren (); | 52 Control [] children = shell.getChildren (); |
49 for (int i=0; i<children.length; i++) { | 53 for (int i=0; i<children.length; i++) { |
55 (cast(Button) e.widget).setSelection (true); | 59 (cast(Button) e.widget).setSelection (true); |
56 } | 60 } |
57 }; | 61 }; |
58 for (int i=0; i<20; i++) { | 62 for (int i=0; i<20; i++) { |
59 Button button = new Button (shell, SWT.TOGGLE); | 63 Button button = new Button (shell, SWT.TOGGLE); |
60 button.setText ("B" ~to!(char[])(i)); | 64 button.setText ("B" ~to!(String)(i)); |
61 button.addListener (SWT.Selection, listener); | 65 button.addListener (SWT.Selection, listener); |
62 if (i == 0) button.setSelection (true); | 66 if (i == 0) button.setSelection (true); |
63 } | 67 } |
64 shell.pack (); | 68 shell.pack (); |
65 shell.open (); | 69 shell.open (); |