O'Reilly logo

Getting Started with Eclipse Juno by Vinicius H. S. Durelli, Rafael Medeiros Teixeira, Rodrigo Fraxino Araujo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Typed and untyped events

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, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required