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

/**
 * The Digital Picasso class is the main class for the Digital Picasso 
 * application. This class keeps all option values and launches all of the
 * inner tabbed panels.
 * 
 * @author Loren Segal
 * @version 1.0
 */
import java.awt.*;
import javax.swing.*;
 
public class DigitalPicasso extends JFrame
{
    private static int          faceWidth = 100;
    private static int          faceHeight = 100;
    private static HatEnum      hatStyle = HatEnum.LINCOLN;
    private static ShadesEnum   shadesStyle = ShadesEnum.LENNON;
    private static ColorEnum    faceColor = ColorEnum.Pink;
    private static ColorEnum    shadesColor = ColorEnum.Red;
    private static ColorEnum    hatColor = ColorEnum.Black;
    
    public DigitalPicasso()
    {
	super("Digital Picasso");
 
	this.setPreferredSize(new Dimension(400, 450));
 
	JTabbedPane tabs = new JTabbedPane();
	tabs.addTab("Face", null, new FacePanel(), "General settings");
	tabs.addTab("Colours", null, new ColourPanel(), "Colour settings");
	tabs.addTab("Draw", null, new DrawPanel(), "Draw");
	this.add(tabs);
 
	this.pack();
	this.setVisible(true);
    }
 
    // SET METHOD FOR GLOBAL OPTIONS
    
    public static void setFaceWidth(int width)
    {
	faceWidth = width;
    }
 
    public static void setFaceHeight(int height)
    {
	faceHeight = height;
    }
 
    public static void setHatStyle(HatEnum hat)
    {
	hatStyle = hat;
    }
    
    public static void setShadesStyle(ShadesEnum shades)
    {
	shadesStyle = shades;
    }
 
    public static void setFaceColor(ColorEnum c)
    {
	faceColor = c;
    }
    
    public static void setHatColor(ColorEnum c)
    {
	hatColor = c;
    }
 
    public static void setShadesColor(ColorEnum c)
    {
	shadesColor = c;
    }
    
    // GET METHODS FOR GLOBAL OPTIONS
    
    public static int getFaceWidth()
    {
	return faceWidth;
    }
 
    public static int getFaceHeight()
    {
	return faceHeight;
    }
 
    public static HatEnum getHatStyle()
    {
	return hatStyle;
    }
 
    public static ShadesEnum getShadesStyle()
    {
	return shadesStyle;
    }
 
    public static ColorEnum getFaceColor()
    {
	return faceColor;
    }
    
    public static ColorEnum getHatColor()
    {
	return hatColor;
    }
 
    public static ColorEnum getShadesColor()
    {
	return shadesColor;
    }   
    
    // MAIN METHOD
    
    public static void main(String[] args)
    {
	DigitalPicasso p = new DigitalPicasso();
    }
}