Book Image

NetBeans IDE 8 Cookbook

By : David Salter, Rhawi Dantas
Book Image

NetBeans IDE 8 Cookbook

By: David Salter, Rhawi Dantas

Overview of this book

<p>From the start to the end of a Java project's lifecycle, this book will show you how to perform many key tasks with the NetBeans IDE, uncovering more about mobile, desktop, and enterprise Java along the way.</p> <p>You will start by creating Java projects and learning how to refactor and use NetBeans tools to increase developer efficiency. You will then get a walkthrough of how to create a desktop application before covering JavaFX and mobile applications and how to use external services within them. Having seen how to create many different types of applications, you will then be shown how to test and profile them before storing them in revision control systems such as Git or Subversion. Finally, you will learn how to extend NetBeans itself by adding new features to the IDE.</p>
Table of Contents (19 chapters)
NetBeans IDE 8 Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Responding to events


So far, we've designed a Swing desktop application. We've added some controls onto a form, added a menu system, and added a toolbar. At the moment, there's no functionality behind the controls and menu items.

The next step after designing a Swing desktop application is to add behaviors to it.

In Swing, this is done by implementing event listeners. Firstly, we must register specific objects, the event listeners, onto Swing components in order to perform a determined task. When an event is triggered, the Swing component passes this to the listeners to handle the action according to what was implemented.

There are multiple kinds of events in Swing that include 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

To complete this recipe, we need to have the JarViewer project that was created in the Creating toolbars recipe. If you have not completed this recipe...