JButtons
JButtons may also have an icon or text or both. The alignment methods are inherited from the abstract button class.
In Swing, many components are implemented in terms of the model-view-controller design pattern. That is, there are separate classes for the different parts of the components:
- contents, such as the state of the button, or the text of the textfield
- visual appearance (color, size, and so on )
- behavior (reaction to events )
Note that the Abstract Button class allows the use of other models.
JButtons, JCheckboxes, and JRadioButtons may have the same model, but different view and controller.