In the last lesson we have already introduced the basic concepts of event handling. The WindowAdapter class has been used to make a framed window closeable. Now we have a look how buttons can be created and how they can be used for action handling. Buttons are descendants of the Component class. They can be placed within a container.
Frame is such a container class.
Buttons are added to a container. For this purpose, the concept of layout management is introduced. For the moment we use FlowLayout , which means components are lined up horizontally until there is no more room and a new line of components is started. When you resize the frame, the component layout will also be rearranged. Of course we would like to react in a different way if the buttons are pressed.