The 1.1 version of the JDK introduced a handy new construct: inner classes. Our intent here is not to provide an in-depth discussion of inner classes—if you are so inclined, you can find such a discussion from the Java home page (http://java.sun.com). Instead, we will show how inner classes can be used for handling events.
Inner classes are pertinent to event handling because they can be used to simplify the relationship between event sources and listeners. In Java, a class can be a top-level class or an inner class. Top-level classes are members of a package and were the only type of classes in the 1.0 JDK. Inner classes are classes that can be defined within a block or as part of a new expression.
To start off with, ...