import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

/**
 * An example that uses buttons
 *
 * @author  Prof. David Bernstein, James Madison University
 * @version 1.0
 */
public class ButtonHandler implements ActionListener
{
    private JLabel outputLabel;
    

    /**
     * Ecplicit Value Constructor.
     */
    public ButtonHandler(JLabel outputLabel)
    {
        this.outputLabel = outputLabel;
    }


    /**
     * Handle actionPerformed message (required by ActionListener)
     *
     * @param event   The ActionEvent that generatedt his message
     */
    public void actionPerformed(ActionEvent event)
    {
       String       command;
       
       command = event.getActionCommand();
       if (command.equals("No"))
       {
          outputLabel.setText("Don't disagree with me!");
       }
       else if (command.equals("Yes"))
       {
          outputLabel.setText("I really respect your opinion.");
       }
    }
    
}
