comparison org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet39.d @ 112:9f4c18c268b2

Update to compile and execute with dmd 2.052.
author kntroh
date Wed, 16 Mar 2011 21:53:53 +0900
parents 4e5843b771cc
children 536e43f63c81
comparison
equal deleted inserted replaced
111:b6e9904989ed 112:9f4c18c268b2
26 import org.eclipse.swt.layout.GridLayout; 26 import org.eclipse.swt.layout.GridLayout;
27 import org.eclipse.swt.widgets.Display; 27 import org.eclipse.swt.widgets.Display;
28 import org.eclipse.swt.widgets.Shell; 28 import org.eclipse.swt.widgets.Shell;
29 29
30 import java.lang.all; 30 import java.lang.all;
31 import tango.util.Convert; 31 version(Tango){
32 import tango.io.Stdout; 32 import tango.io.Stdout;
33 import tango.util.Convert;
34 } else { // Phobos
35 import std.stdio;
36 import std.conv;
37 }
33 public static void main(String[] args) { 38 public static void main(String[] args) {
34 Display display = new Display(); 39 Display display = new Display();
35 Shell shell = new Shell(display); 40 Shell shell = new Shell(display);
36 shell.setLayout(new GridLayout()); 41 shell.setLayout(new GridLayout());
37 42
38 CCombo combo = new CCombo(shell, SWT.FLAT | SWT.BORDER); 43 CCombo combo = new CCombo(shell, SWT.FLAT | SWT.BORDER);
39 combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); 44 combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
40 for (int i = 0; i < 5; i++) { 45 for (int i = 0; i < 5; i++) {
41 combo.add("item" ~ to!(char[])(i)); 46 combo.add("item" ~ to!(String)(i));
42 } 47 }
43 combo.setText("item0"); 48 combo.setText("item0");
44 49
45 combo.addSelectionListener(new class() SelectionAdapter { 50 combo.addSelectionListener(new class() SelectionAdapter {
46 public void widgetSelected(SelectionEvent e) { 51 public void widgetSelected(SelectionEvent e) {
47 Stdout.formatln("Item selected"); 52 version(Tango){
53 Stdout.formatln("Item selected");
54 } else { // Phobos
55 writeln("Item selected");
56 }
48 }; 57 };
49 }); 58 });
50 59
51 shell.pack(); 60 shell.pack();
52 shell.open(); 61 shell.open();