Alternatively, you may wish to combine the listener defined in Segment 1007 with the demonstration application defined in Segment 1008, by defining the listener as an inner class.