O'Reilly logo

NetBeans IDE 7 Cookbook by Rhawi Dantas

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

Adding Event Listeners

The next step after designing and building a Desktop application is to add behaviors to it.

In Swing, this is done by implementing Event Listeners. Swing Components register specific objects, the Event Listeners, in order to perform a determined task. When an event is triggered, the Listeners capture this call and handle the action according to what was implemented. Listeners also provide Events to those methods.

There are multiple kinds of events in Swing that range from mouse, focus, key, and window events.

For a more detailed view of Event Listeners, visit:

http://download.oracle.com/javase/tutorial/uiswing/events/intro.html

Getting ready

It is necessary to have the sources of a Java Desktop Application recipe in your NetBeans ...

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