// Decompiled by Jad v1.5.7f. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   StatusComponent.java

import java.awt.*;

public class StatusComponent extends RoundedComponent
{

    StatusComponent(int i, int j)
    {
        super(i, j, 216, cHeight, 2);
        colDeep = new Color(255, 204, 204);
        colShallow = new Color(255, 255, 255);
        lastABN = -1;
        setBackground(Color.white);
        setLayout(null);
        barsNumber = ((wGTime + ofs) - progFrom - 2) / 3;
        activeBarsNumber = 0;
        lTime = new Label("0:00");
        lTime.setBackground(currentColor);
        lTime.reshape(ofs + wGTime + wSpace, 0, wTime, cHeight);
        lTime.setAlignment(1);
        add(lTime);
        lPoints = new Label("0");
        lPoints.setBackground(currentColor);
        lPoints.reshape(ofs + wGTime + 2 * wSpace + wTime, 0, wPoints, cHeight);
        lPoints.setAlignment(1);
        add(lPoints);
    }

    public void paint(Graphics g)
    {
        if(currentRnd != null)
            g.drawImage(currentRnd, 0, 0, this);
        g.setColor(Color.white);
        g.fillRect((ofs + wGTime + wSpace) - 2, 0, 2, cHeight);
        g.fillRect((ofs + wGTime + 2 * wSpace + wTime) - 2, 0, 2, cHeight);
        for(int i = 0; i < activeBarsNumber; i++)
        {
            if(i > 5)
            {
                g.setColor(currentColor);
                g.fillRect(progFrom + i * 3, 0, 3, cHeight);
            }
            g.setColor(colShallow);
            int k = 7 - i * 3;
            if(k < progHeight)
                k = progHeight;
            g.fillRect(progFrom + i * 3, k, 2, cHeight - k * 2);
        }

        for(int j = activeBarsNumber; j < barsNumber; j++)
        {
            if(j > 5)
            {
                g.setColor(currentColor);
                g.fillRect(progFrom + j * 3, 0, 3, cHeight);
            }
            g.setColor(colDeep);
            int l = 7 - j * 3;
            if(l < progHeight)
                l = progHeight;
            g.fillRect(progFrom + j * 3, l, 2, cHeight - l * 2);
        }

        g.setColor(currentColor);
        g.fillRect(progFrom + barsNumber * 3, 0, 2, cHeight);
    }

    void setTime(int i)
    {
        lTime.setText(i / 60 / 10 + "" + (i / 60) % 10 + ":" + (i % 60) / 10 + "" + i % 60 % 10);
    }

    void timeChange(int i, int j)
    {
        activeBarsNumber = (barsNumber * i) / 100;
        if(activeBarsNumber > barsNumber)
            activeBarsNumber = barsNumber;
        if(activeBarsNumber != lastABN)
        {
            repaint();
            lastABN = activeBarsNumber;
        }
        setTime(j);
    }

    public void update(Graphics g)
    {
        paint(g);
    }

    static int ofs = 23;
    static int wGTime = 110;
    static int wPoints = 40;
    static int wTime = 40;
    static int wSpace = 2;
    static int cHeight = 22;
    static int progHeight = 3;
    static int progFrom = 5;
    Color colDeep;
    Color colShallow;
    Label lPoints;
    Label lTime;
    int barsNumber;
    int activeBarsNumber;
    int lastABN;

}
