// Decompiled by Jad v1.5.7. Copyright 1997-99 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   Rect.java

package com.symantec.itools.awt.shape;

import java.awt.Component;
import java.awt.Graphics;

import com.symantec.itools.awt.BevelStyle;

// Referenced classes of package symantec.itools.awt.shape:
//            Shape

public class Rect extends Shape
{

    public Rect()
    {
    }

    public boolean contains(int i, int j)
    {
        if(fill)
            return super.contains(i, j);
        if(j == 0 || j == height - 1)
            return i >= 0 && i < width;
        if(i == 0 || i == width - 1)
            return j >= 0 && j < height;
        else
            return false;
    }

    public void paint(Graphics g)
    {
        super.paint(g);
        g.clipRect(0, 0, width, height);
        int i = width - 1;
        int j = height - 1;
        switch(style)
        {
        case 2: // '\002'
            if(fill)
            {
                g.setColor(fillColor);
                g.fillRect(0, 0, i, j);
            }
            g.setColor(getForeground());
            g.drawRect(0, 0, i, j);
            return;

        case 0: // '\0'
            if(fill)
            {
                g.setColor(fillColor);
                g.fillRect(1, 1, i - 1, j - 1);
            }
            g.setColor(bevelDarkerColor);
            g.drawLine(0, j, 0, 0);
            g.drawLine(0, 0, i, 0);
            g.setColor(bevelLighterColor);
            g.drawLine(i, 0, i, j);
            g.drawLine(i, j, 0, j);
            return;

        case 1: // '\001'
            if(fill)
            {
                g.setColor(fillColor);
                g.fillRect(1, 1, i - 1, j - 1);
            }
            g.setColor(bevelLighterColor);
            g.drawLine(0, j, 0, 0);
            g.drawLine(0, 0, i, 0);
            g.setColor(bevelDarkerColor);
            g.drawLine(i, 0, i, j);
            g.drawLine(i, j, 0, j);
            return;

        }
        if(fill)
        {
            g.setColor(fillColor);
            g.fillRect(0, 0, width, height);
            return;
        }
        else
        {
            g.setColor(getForeground());
            g.drawRect(0, 0, i, j);
            return;
        }
    }
}
