Viewing file: comp249/assignment2/ColourPanel.java | Back to directory listing
Author: Loren Segal | Last modified: February 21 2006 12:00 am | Download

/**
 * ColourPanel selects all of the colour options (hat/shades/face)
 *
 * @author  Loren Segal
 * @version 1.0
 */
import javax.swing.*;
import java.awt.*;
 
public class ColourPanel extends JPanel
{
    private JPanel hatColorPanel    = new SwatchPanel("Hat Colour", DigitalPicasso.getHatColor());
    private JPanel shadesColorPanel = new SwatchPanel("Shades Colour", DigitalPicasso.getShadesColor());
    private JPanel faceColorPanel   = new SwatchPanel("Face Colour", DigitalPicasso.getFaceColor());
 
    /** 
     * ColourPanel creates a new panel to choose colours.
     * 
     */
    public ColourPanel() 
    {
	super(new FlowLayout(FlowLayout.CENTER, 10, 10));
	
	JPanel centerPanel = new JPanel(new GridLayout(3,1,0,15));
	
	// Add the three swatch panels
	centerPanel.add(hatColorPanel);
	centerPanel.add(shadesColorPanel);
	centerPanel.add(faceColorPanel);
	add(centerPanel);
    }       
}