Chapter 2 -- Event Based Programming Basics

This chapter introduces you to the fundamentals of event based programming.  Obviously, if we are going to discuss programming, we will have examples, and those examples will be implemented in some language.  We chose Java. Java has a clean event model where each class or interface plays a particular role and where the various components work together nicely to form an entire application.  Since, Java is (mostly) platform independent, you may work through all our examples under Windows, or Linux, or on a Mac -- on almost any desktop computer.

Graphical User Interfaces (GUIs) are also a good way to introduce the nuts and bolts of event based programming. 
GUI components such as menus, check boxes, radio buttons, and text boxes communicate with an application via events.  The purpose of this chapter is not to study GUI programming in depth. GUI programming deserves a complete textbook, and there are already many good texts on the topic.  Our purpose is to illustrate various aspects of event based programming.  We use GUIs as the domain.

Java includes two packages for GUI development, the Abstract Window Toolkit (AWT) and Swing
Our examples use Swing.  Swing is the newer package and the more popular of the two.

Chapter 2 - Java Event Programming

Text Examples

Other Examples