For processing an event, it is necessary to use a listener. In the first versions of the SWT API, there were only untyped listeners. These listeners provide a simple mechanism to handle the events. There is only one generic interface called Listener and an event class called Event. In order to add a listener, it is necessary to use the addListener
method.
After some discussion among the Eclipse community, it was decided that a more familiar pattern would be introduced in the SWT API. These are the typed listeners, that were defined in terms of the untyped ones, and they can be found in the org.eclipse.swt.events
package. We can see the difference among them in the following snippet of code:
... widget.addListener(SWT.Dispose, new Listener() { public void handleEvent(Event event) { // widget was disposed } }); ... ... widget.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent event) { // widget was disposed...