Running the Program

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   go to next page

Answer:

The super class constructor sets the title:

super( title )

Running the Program

Button Demo Picture

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. 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?