There is no listener for the button's events. If there is no listener for a particular type of event, then the program ignores events of that type.
When you add()
buttons (and other components)
to a container,
a layout manager automatically
decides what size they will be and where they will go.
This is convenient,
because you can add components
without worrying about the details.
The layout
manager is like a little artist inside the computer.
You say what components you want and
the layout manager lays them out in the picture.
The layout manager sometimes makes odd choices. However, there are several kinds of layout managers. Each layout manager has a different style of positioning components. Usually there is a layout manager that will do the job you want. If you don't specify otherwise, the container will use a default layout manager.
Should the layout manager be specified before or after components are added to the frame?