/*
 * File: ColorFunStandard.java
 * ---------------------
 * This implements a changing background color program using the Standard Libraries!
 */

import acm.program.*;
import javax.swing.*;

import java.awt.Color;
import java.awt.event.*;

public class ColorFunStandard implements ActionListener {
	public static void main(String[] args) {
		new ColorFunStandard().init();
	}
	private JFrame frame;
	public void init() {
		frame = new JFrame("ColorFun");
		frame.setSize(500, 500);
		JButton redButton = new JButton("Red!");
		JButton blueButton = new JButton("Blue!");
		redButton.addActionListener(this);
		blueButton.addActionListener(this);
		frame.add(redButton, "South");
		frame.add(blueButton, "North");
		frame.setVisible(true);
	}

	public void actionPerformed(ActionEvent e) {
		if(e.getActionCommand().equals("Blue!")){
			frame.setBackground(Color.BLUE);
		} else {
			frame.setBackground(Color.RED);
		}
	}
}






