Actually, there are many events the GUI may generate, but other than button clicks, most of those events are ignored. There are other events, such as clicking on the "close" button on the frame, that are not ignored, but are handled by the frame.
You might have said that each button needs its own listener. That would work, but we can use just one listener. First write a class definition for the container frame. Here is a skeleton:
Notice that this program includes main()
inside the TwoButtons
class.
For now, just decide what class this new one extends and what
interface it will implement.
Then fill in the constructor in main()