Mercurial > projects > dwt-samples
diff dwtexamples/helloworld/HelloWorld2.d @ 0:052c3aebd1d3
initial import
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Fri, 01 Feb 2008 21:46:26 +0100 |
parents | |
children | b61e7baf0574 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwtexamples/helloworld/HelloWorld2.d Fri Feb 01 21:46:26 2008 +0100 @@ -0,0 +1,41 @@ +/******************************************************************************* + * Copyright (c) 2000, 2003 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +module dwtexamples.helloworld.HelloWorld2; + +import dwt.DWT; +import dwt.widgets.Display; +import dwt.widgets.Label; +import dwt.widgets.Shell; + +/* + * This example builds on HelloWorld1 and demonstrates the minimum amount + * of code required to open an DWT Shell with a Label and process the events. + */ + +void main(){ + Display display = new Display (); + Shell shell = new Shell (display); + Label label = new Label (shell, DWT.CENTER); + label.setText ("Hello_world"); + label.setBounds (shell.getClientArea ()); + shell.open (); + while (!shell.isDisposed ()) { + if (!display.readAndDispatch ()) display.sleep (); + } + display.dispose (); +} + +// for unknown reason, there are linker errors. These imports are the workaround +import tango.io.Stdout; +import tango.math.Math; +import tango.text.convert.Format; +import tango.util.Convert; +import tango.util.PathUtil;