SimpleButton3 (other files are same as before)

Main.java  [download]

/*
 * Simple button program, with 2 buttons
 */

import java.awt.Container;
import java.awt.FlowLayout;
import javax.swing.JFrame;

public class Main extends JFrame {
    public static void main (String [] args) {
	new Main ();
    }
    
    public Main () {
	// Window setup
	setSize (300, 300);
	Container content = getContentPane();
	content.setLayout (new FlowLayout()); //*1 Attach a Layout to the content pane of the window

	// Put a button in
	MyButton b1 = new MyButton ("Push me"); //*2 Then you can add more than one widget
	content.add (b1); //*2

	// Put another button in
	MyButton b2 = new MyButton ("Push me also"); //*2
	content.add (b2); //*2

	// Show the window
	setVisible (true);
    }
}