28
|
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 org.eclipse.swt.snippets.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
|
|
24 import org.eclipse.swt.SWT;
|
|
25 import org.eclipse.swt.graphics.Image;
|
|
26 import org.eclipse.swt.layout.GridLayout;
|
|
27 import org.eclipse.swt.widgets.Button;
|
|
28 import org.eclipse.swt.widgets.Display;
|
|
29 import org.eclipse.swt.widgets.Shell;
|
|
30
|
|
31 import java.lang.all;
|
|
32
|
|
33 void main(String[] args){
|
|
34 Snippet206.main(args);
|
|
35 }
|
|
36
|
|
37 public class Snippet206 {
|
|
38 public static void main(String[] args) {
|
|
39 Display display = new Display();
|
|
40 Image image = display.getSystemImage(SWT.ICON_QUESTION);
|
|
41 Shell shell = new Shell(display);
|
|
42 shell.setLayout (new GridLayout());
|
|
43 Button button = new Button(shell, SWT.PUSH);
|
|
44 button.setImage(image);
|
|
45 button.setText("Button");
|
|
46 shell.setSize(300, 300);
|
|
47 shell.open();
|
|
48 while (!shell.isDisposed ()) {
|
|
49 if (!display.readAndDispatch ()) display.sleep ();
|
|
50 }
|
|
51 display.dispose ();
|
|
52 }
|
|
53 }
|