That'll teach you to let NetBeans design your GUI for you
You would have done far better to write the thing by hand! I often do. I have written about it in the past, try
here.
What you have is an anonymous inner class, attached to each object in your display. I am sure this is a good object-oriented way to program, but you will have problems if you have several buttons which do similar things.
What you are doing is
1: Registering a listener with the addXXXListener method.2: Creating a Listener object, here as an anonymous instance of the XXXListener interface, passed to that addXXX method.3: Implementing the method(s) of that XXXListener interface.4: Passing the activity to a method written elsewhere.NetBeans or whatever tends to give the objects and methods rather awkward names like button1 button2 and listener3.
When something happens to the Component, it sends off an XXXEvent object, which starts with the Component itself. If the Component has a Listener, that Listener catches the Event. Otherwise, I think, it passes to the "parent" ie Component enclosing. Then to whatever encloses that, etc etc., until it reaches the top-level Container. If it hasn't been caught by then, it vanishes into some sort of cyber-limbo never to be seen again. At least I think it does. Not sure.
If the Event is caught, however, it invokes the method(s) of its Listener.