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 icon of the frame, that are not ignored, but are handled by the frame.
You might have answered 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, decide what class to extend and what interface to implement.