Answer:

The parameter of the constructor is a string that will label the button.

Running the Program

Frame Filled with Big Button

To run the program, copy, save and compile the program in the usual way. Name the source file ButtonDemo.java.

C:\> javac ButtonDemo.java
C:\> java ButtonDemo
C:\>

The picture shows what the program displays. The entire frame is filled with the button! (We will fix this shortly.) You can move the mouse pointer over the button and click on it, and the button will appear to move in and out. But the program does nothing in response to that event.

QUESTION 4:

Why does nothing happen when you click the button?