13.14. The Button Class
The Button class creates push buttons with text labels. The Java programming language doesn't have a built-in class that supports buttons with images. The most common usage for a button is to simply create one with a specified label, drop it in a window, then watch for action events when the button is pressed. For instance, to create and add a button to the current window, you would perform the following two steps.
Button button = new Button("..."); add(button);
The Button class has two constructors.
public Button(String buttonLabel)
The first constructor creates a button with no label. You can use setLabel to add a label to the button later. The width reported by preferredSize is greater ...