Mercurial > projects > dwt-samples
comparison snippets/button/Snippet206.d @ 114:0de3dab4d6e1
Add buttons snippets. Thanks TomD.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Fri, 11 Jul 2008 21:10:38 +0200 |
parents | |
children | 8cdaac0dc743 |
comparison
equal
deleted
inserted
replaced
113:7194dba256b8 | 114:0de3dab4d6e1 |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2000, 2005 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 * Thomas Demmer <t_demmer AT web DOT de> | |
12 *******************************************************************************/ | |
13 module button.Snippet206; | |
14 | |
15 /* | |
16 * Button example snippet: a Button with text and image | |
17 * | |
18 * For a list of all SWT example snippets see | |
19 * http://www.eclipse.org/swt/snippets/ | |
20 * | |
21 * @since 3.2 | |
22 */ | |
23 /* Port OK */ | |
24 | |
25 import dwt.DWT; | |
26 import dwt.graphics.Image; | |
27 import dwt.layout.GridLayout; | |
28 import dwt.widgets.Button; | |
29 import dwt.widgets.Display; | |
30 import dwt.widgets.Shell; | |
31 | |
32 import dwt.dwthelper.utils; | |
33 | |
34 void main(String[] args){ | |
35 Snippet206.main(args); | |
36 } | |
37 | |
38 public class Snippet206 { | |
39 public static void main(String[] args) { | |
40 Display display = new Display(); | |
41 Image image = display.getSystemImage(DWT.ICON_QUESTION); | |
42 Shell shell = new Shell(display); | |
43 shell.setLayout (new GridLayout()); | |
44 Button button = new Button(shell, DWT.PUSH); | |
45 button.setImage(image); | |
46 button.setText("Button"); | |
47 shell.setSize(300, 300); | |
48 shell.open(); | |
49 while (!shell.isDisposed ()) { | |
50 if (!display.readAndDispatch ()) display.sleep (); | |
51 } | |
52 display.dispose (); | |
53 } | |
54 } |