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 *******************************************************************************/ 11 package org.eclipse.swt.widgets; 12 13 14 /** 15 * Implementers of <code>Listener</code> provide a simple 16 * <code>handleEvent()</code> method that is used internally 17 * by SWT to dispatch events. 18 * <p> 19 * After creating an instance of a class that implements this interface 20 * it can be added to a widget using the 21 * <code>addListener(int eventType, Listener handler)</code> method and 22 * removed using the 23 * <code>removeListener (int eventType, Listener handler)</code> method. 24 * When the specified event occurs, <code>handleEvent(...)</code> will 25 * be sent to the instance. 26 * </p> 27 * <p> 28 * Classes which implement this interface are described within SWT as 29 * providing the <em>untyped listener</em> API. Typically, widgets will 30 * also provide a higher-level <em>typed listener</em> API, that is based 31 * on the standard <code>java.util.EventListener</code> pattern. 32 * </p> 33 * <p> 34 * Note that, since all internal SWT event dispatching is based on untyped 35 * listeners, it is simple to build subsets of SWT for use on memory 36 * constrained, small footprint devices, by removing the classes and 37 * methods which implement the typed listener API. 38 * </p> 39 * 40 * @see Widget#addListener 41 * @see java.util.EventListener 42 * @see org.eclipse.swt.events 43 */ 44 public interface Listener { 45 46 /** 47 * Sent when an event that the receiver has registered for occurs. 48 * 49 * @param event the event which occurred 50 */ 51 void handleEvent (Event event); 52 } 53