Mercurial > projects > dwt-samples
comparison examples/simple.d @ 78:4a04b6759f98
Clean up directory names
author | John Reimer <terminal.node@gmail.com> |
---|---|
date | Sat, 10 May 2008 13:32:45 -0700 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
76:04f122e90b0a | 78:4a04b6759f98 |
---|---|
1 module example.simple; | |
2 | |
3 import dwt.DWT; | |
4 import dwt.events.SelectionEvent; | |
5 import dwt.events.SelectionListener; | |
6 import dwt.widgets.Button; | |
7 import dwt.widgets.Display; | |
8 import dwt.widgets.Shell; | |
9 import dwt.widgets.Text; | |
10 | |
11 import tango.io.Stdout; | |
12 | |
13 void main(){ | |
14 | |
15 try{ | |
16 | |
17 Display display = new Display(); | |
18 Shell shell = new Shell(display); | |
19 shell.setSize(300, 200); | |
20 shell.setText("Simple DWT Sample"); | |
21 auto btn = new Button( shell, DWT.PUSH ); | |
22 btn.setBounds(40, 50, 100, 50); | |
23 btn.setText( "hey" ); | |
24 | |
25 auto txt = new Text(shell, DWT.BORDER); | |
26 txt.setBounds(170, 50, 100, 40); | |
27 | |
28 btn.addSelectionListener(new class () SelectionListener { | |
29 public void widgetSelected(SelectionEvent event) { | |
30 txt.setText("No problem"); | |
31 } | |
32 public void widgetDefaultSelected(SelectionEvent event) { | |
33 txt.setText("No worries!"); | |
34 } | |
35 }); | |
36 | |
37 shell.open(); | |
38 while (!shell.isDisposed()) { | |
39 if (!display.readAndDispatch()) { | |
40 display.sleep(); | |
41 } | |
42 } | |
43 } | |
44 catch (Exception e) { | |
45 Stdout.formatln (e.toString); | |
46 } | |
47 } | |
48 |