package ola.jsame;

import javax.swing.Icon;
import java.awt.Graphics;
import java.awt.Color;
import java.awt.Component;

/**
 *
 * @author Owen Astrachan
 */

public class OOGAIcon implements Icon
{
    /**
     */
    public OOGAIcon()
    {
    }

    /**
     * Draws this plain icon at the proper size.
     * @param c is used to determine how big to draw this Icon
     * @param g is the graphics context in which drawing takes place
     */
    public void paintIcon(Component c, Graphics g, int x, int y)
    {
	int w = c.getWidth();
        int h = c.getHeight();
	Color color = ((OOGAButton) c).getColor();
        doPaint(g,Color.blue,color,w,h);
    }

    private void doPaint(Graphics g, Color background,
			 Color foreground, int width, int height)
    {
	g.setColor(background);
	g.fill3DRect(0,0,width,height,true);
	g.setColor(foreground);
	g.fill3DRect(OOGAConsts.OFFSET,OOGAConsts.OFFSET,
			 width,height,true);
	g.setColor(Color.black);
    }

    /**
     * Needed for interface, not used in this project.
     */
    public int getIconHeight()
    {
	return 5;
    }

    /**
     * Needed for interface, not used in this project.
     */
    public int getIconWidth()
    {
	return 5;
    }
}
