|
Revision 78:4a04b6759f98, 1.2 kB
(checked in by John Reimer <terminal.node@gmail.com>, 7 months ago)
|
Clean up directory names
|
| Line | |
|---|
| 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 |
} |
|---|