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 *******************************************************************************/
|
|
11 module examples.helloworld.HelloWorld4;
|
|
12
|
|
13 import dwt.DWT;
|
|
14 import dwt.layout.FillLayout;
|
|
15 import dwt.widgets.Display;
|
|
16 import dwt.widgets.Label;
|
|
17 import dwt.widgets.Shell;
|
|
18
|
|
19 /*
|
|
20 * This example builds on HelloWorld2 and demonstrates how to resize the
|
|
21 * Label when the Shell resizes using a Layout.
|
|
22 */
|
|
23 void main () {
|
|
24 Display display = new Display ();
|
|
25 Shell shell = new Shell (display);
|
|
26 shell.setLayout(new FillLayout());
|
|
27 Label label = new Label (shell, DWT.CENTER);
|
|
28 label.setText ("Hello_world");
|
|
29 shell.pack ();
|
|
30 shell.open ();
|
|
31 while (!shell.isDisposed ()) {
|
|
32 if (!display.readAndDispatch ()) display.sleep ();
|
|
33 }
|
|
34 display.dispose ();
|
|
35 }
|