Mercurial > projects > dwt2
comparison org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet142.d @ 112:9f4c18c268b2
Update to compile and execute with dmd 2.052.
author | kntroh |
---|---|
date | Wed, 16 Mar 2011 21:53:53 +0900 |
parents | 8ae65ae167f5 |
children | 536e43f63c81 |
comparison
equal
deleted
inserted
replaced
111:b6e9904989ed | 112:9f4c18c268b2 |
---|---|
28 import org.eclipse.swt.widgets.Listener; | 28 import org.eclipse.swt.widgets.Listener; |
29 import org.eclipse.swt.widgets.Shell; | 29 import org.eclipse.swt.widgets.Shell; |
30 | 30 |
31 import java.lang.all; | 31 import java.lang.all; |
32 | 32 |
33 //import tango.core.Thread; | 33 version(Tango){ |
34 import tango.io.Stdout; | 34 //import tango.core.Thread; |
35 import tango.io.Stdout; | |
36 } else { // Phobos | |
37 import std.stdio; | |
38 } | |
35 | 39 |
36 void main(String[] args) { | 40 void main(String[] args) { |
37 Display display = new Display(); | 41 Display display = new Display(); |
38 Shell shell = new Shell(display); | 42 Shell shell = new Shell(display); |
39 Button button = new Button(shell,SWT.NONE); | 43 Button button = new Button(shell,SWT.NONE); |
40 button.setSize(100,100); | 44 button.setSize(100,100); |
41 button.setText("Click"); | 45 button.setText("Click"); |
42 shell.pack(); | 46 shell.pack(); |
43 shell.open(); | 47 shell.open(); |
44 button.addListener(SWT.MouseDown, dgListener( (Event e){ | 48 button.addListener(SWT.MouseDown, dgListener( (Event e){ |
45 Stdout.formatln("Mouse Down (Button: {} x: {} y: {})",e.button,e.x,e.y); | 49 version(Tango){ |
50 Stdout.formatln("Mouse Down (Button: {} x: {} y: {})",e.button,e.x,e.y); | |
51 } else { // Phobos | |
52 writefln("Mouse Down (Button: %s x: %s y: %s)",e.button,e.x,e.y); | |
53 } | |
46 })); | 54 })); |
47 Point pt = display.map(shell, null, 50, 50); | 55 Point pt = display.map(shell, null, 50, 50); |
48 Thread thread = new Thread({ | 56 Thread thread = new Thread({ |
49 Event event; | 57 Event event; |
50 try { | 58 try { |