1 /******************************************************************************* 2 * Copyright (c) 2000, 2003 IBM Corporation and others. 3 * 4 * This program and the accompanying materials 5 * are made available under the terms of the Eclipse Public License 2.0 6 * which accompanies this distribution, and is available at 7 * https://www.eclipse.org/legal/epl-2.0/ 8 * 9 * SPDX-License-Identifier: EPL-2.0 10 * 11 * Contributors: 12 * IBM Corporation - initial API and implementation 13 *******************************************************************************/ 14 package org.eclipse.swt.examples.helloworld; 15 16 17 import org.eclipse.swt.widgets.*; 18 19 /* 20 * This example demonstrates the minimum amount of code required 21 * to open an SWT Shell and process the events. 22 */ 23 public class HelloWorld1 { 24 main(String [] args)25public static void main (String [] args) { 26 Display display = new Display (); 27 Shell shell = new HelloWorld1 ().open (display); 28 while (!shell.isDisposed ()) { 29 if (!display.readAndDispatch ()) display.sleep (); 30 } 31 display.dispose (); 32 } 33 open(Display display)34public Shell open (Display display) { 35 Shell shell = new Shell (display); 36 shell.open (); 37 return shell; 38 } 39 } 40