In the constructor, the Components are actually added to the display and their properties can be modified. The main method is invoked when the class is run from the command line. For the most part, components and there associated events can be added in the constructor. It is this method that created the association between a component and the event. The parameter to the addActionListener method is a class called an ActionListener.
Inner Classes allow classes to be defined as members of other classes or within a block of code.
The ActionListener in the above code fragment is also anonymous. This is the first instance of a class declaration that did not include a name. Anonymous, inner classes are perfect for associated events with components. Timer1's event, where the real action occurs will not be defined as anonymous inner class. The constructor for Timer's take 2 parameters.