import java.awt.*;
import javax.swing.*;


/**
 * An example that uses a button
 *
 * @author  Prof. David Bernstein, James Madison Univeristy
 * @version 1.0
 */
public class ButtonDriver
{

    /**
     * The entry point of the example
     *
     * @param args   The command line arguments
     */
    public static void main(String[] args)
    {
        Container   contentPane;
        JButton     noButton, yesButton;
	JFrame      window;
        JLabel      titleLabel;


	window = new JFrame("A Really Amazing Window!");
        window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        
        // Get the content pane
        contentPane = window.getContentPane();
        contentPane.setLayout(null);
        
        // Construct the widgets.components
        titleLabel = new JLabel("A Button Example");
        yesButton  = new JButton("Yes");
        noButton = new JButton("No");

        // Layout the content pane
        contentPane.add(titleLabel);
        titleLabel.setBounds(60,20,290,30);

        contentPane.add(yesButton);
        yesButton.setBounds(190,210,60,30);

        contentPane.add(noButton);
        noButton.setBounds(260,210,90,30);

        
        // Make a ButtonHandler object an ActionListener on the buttons
        ButtonHandler handler = new ButtonHandler(titleLabel);
        
        yesButton.addActionListener(handler);
        noButton.addActionListener(handler);

	window.setSize(400,400);
	window.setVisible(true);
    }
}
