// JDraw - ColorButton class
// Written by Jim Calciano, Melanie Lear, and PJ Waskiewicz
// November 18, 1998
// Class that extends Button to create buttons with a color
// associated with them so when they are selected, the current
// drawing color is set.

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

public class ColorButton extends Button{
  private Color bColor;
  DrawFrame frame;
  public ColorButton(Color c,DrawFrame frame){
    setBackground(c);
    setLabel("       ");
    setSize(100,20);
    bColor = c;
    setForeground(Color.black);
    ColorListener l = new ColorListener();
    addActionListener(l);
    this.frame = frame;
  }
  class ColorListener implements ActionListener{
    public void actionPerformed(ActionEvent e){
      frame.setSelectedColor(bColor);
    }
  }
}