Mercurial > projects > dwt-samples
annotate examples/helloworld/HelloWorld3.d @ 161:eb84f9418bbf
Change module names to this not have examples in the FQN.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 01 Sep 2008 22:24:27 +0200 |
parents | 4a04b6759f98 |
children |
rev | line source |
---|---|
78 | 1 /******************************************************************************* |
2 * Copyright (c) 2000, 2003 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 *******************************************************************************/ | |
161
eb84f9418bbf
Change module names to this not have examples in the FQN.
Frank Benoit <benoit@tionex.de>
parents:
78
diff
changeset
|
11 module helloworld.HelloWorld3; |
78 | 12 |
13 import dwt.DWT; | |
14 import dwt.events.ControlAdapter; | |
15 import dwt.events.ControlEvent; | |
16 import dwt.widgets.Display; | |
17 import dwt.widgets.Label; | |
18 import dwt.widgets.Shell; | |
19 | |
20 /* | |
21 * This example builds on HelloWorld2 and demonstrates how to resize the | |
22 * Label when the Shell resizes using a Listener mechanism. | |
23 */ | |
24 | |
25 void main () { | |
26 Display display = new Display (); | |
27 final Shell shell = new Shell (display); | |
28 final Label label = new Label (shell, DWT.CENTER); | |
29 label.setText ("Hello_world"); | |
30 label.pack(); | |
31 shell.addControlListener(new class() ControlAdapter { | |
32 public void controlResized(ControlEvent e) { | |
33 label.setBounds (shell.getClientArea ()); | |
34 } | |
35 }); | |
36 shell.pack(); | |
37 shell.open (); | |
38 while (!shell.isDisposed ()) { | |
39 if (!display.readAndDispatch ()) display.sleep (); | |
40 } | |
41 display.dispose (); | |
42 } |