Mercurial > projects > dwt-samples
annotate snippets/canvas/Snippet245.d @ 120:1f0a7a472680
fix rm snippets from module statements.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 20 Jul 2008 19:17:23 +0200 |
parents | 29bf9ba4756b |
children |
rev | line source |
---|---|
90 | 1 /******************************************************************************* |
2 * Copyright (c) 2000, 2006 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 * D Port: | |
11 * Bill Baxter <wbaxter> at gmail com | |
12 *******************************************************************************/ | |
120
1f0a7a472680
fix rm snippets from module statements.
Frank Benoit <benoit@tionex.de>
parents:
90
diff
changeset
|
13 module canvas.Snippet245; |
90 | 14 |
15 /* | |
16 * Canvas snippet: paint a circle in a canvas | |
17 * | |
18 * For a list of all SWT example snippets see | |
19 * http://www.eclipse.org/swt/snippets/ | |
20 */ | |
21 | |
22 import dwt.graphics.Rectangle; | |
23 import dwt.widgets.Display; | |
24 import dwt.widgets.Shell; | |
25 import dwt.events.PaintListener; | |
26 import dwt.events.PaintEvent; | |
27 | |
28 void main() | |
29 { | |
30 final Display display = new Display(); | |
31 final Shell shell = new Shell(display); | |
32 shell.addPaintListener(new class(shell) PaintListener { | |
33 Shell shell; | |
34 this(Shell s) { this.shell = s; } | |
35 public void paintControl(PaintEvent event) { | |
36 Rectangle rect = shell.getClientArea(); | |
37 event.gc.drawOval(0, 0, rect.width - 1, rect.height - 1); | |
38 } | |
39 }); | |
40 shell.setBounds(10, 10, 200, 200); | |
41 shell.open (); | |
42 while (!shell.isDisposed()) { | |
43 if (!display.readAndDispatch()) display.sleep(); | |
44 } | |
45 display.dispose(); | |
46 } |