// Copyright Andy Deck 2005, GNU Public License 2
// With the notable provision that any commercial use
// must be approved by the copyright holder.
import java.awt.*;
import java.awt.event.*;

public class demoPalette extends Panel implements MouseListener { 
demoDraw dd;
colorBut cb;

  public demoPalette(demoDraw dd) {
     this.dd = dd;
     setLayout(new GridLayout(36,6));
     setBackground(Color.white);
     int values[] = { 0, 51, 102, 153, 204, 255 };
	
     for(int r = 0; r<6;r++)
        for(int g = 0; g<6;g++)
           for(int b = 0; b<6;b++){
           	cb = new colorBut(new Color(values[r],values[g],values[b]));
			cb.addMouseListener(this);
           	add(cb);
	   }
  }

  public void mousePressed(MouseEvent e){}
  public void mouseReleased(MouseEvent e){}
  public void mouseEntered(MouseEvent e){}
  public void mouseExited(MouseEvent e){}
  public void mouseClicked(MouseEvent e){
            if(e.getSource() instanceof colorBut){
				dd.fillColor = ((Component)e.getSource()).getBackground();
				dd.requestFocus();
           }
   } 
}                     
