// 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:   Clock.java

import java.awt.*;

class GraphicalClock extends Canvas
{

    private String fill(long l)
    {
        return (l >= 10L ? "" : "0") + l;
    }

    private String time()
    {
        long l;
        return (l >= 10L ? "" : "0") + l + ":" + (((l = seconds % 60L) >= 10L ? "" : "0") + l);
    }

    public void paint(Graphics g)
    {
        FontMetrics fontmetrics = g.getFontMetrics();
        char ac[] = {
            '8', '8', ':', '8', '8'
        };
        height = 10 + fontmetrics.getAscent();
        width = 10 + fontmetrics.charsWidth(ac, 0, 5);
        if(master.timing())
        {
            g.setColor(new Color(200, 200, 200));
            g.fillRect(0, 0, getBounds().width, getBounds().height);
            g.setColor(Color.black);
            long l;
            g.drawString(((l = seconds / 60L) >= 10L ? "" : "0") + l + ":" + (((l = seconds % 60L) >= 10L ? "" : "0") + l), 5, (fontmetrics.getAscent() - 1) + 5);
            g.drawRect(0, 0, width, height);
        }
    }

    void incrementSecond()
    {
        seconds++;
        repaint();
    }

    void decrementSecond()
    {
        seconds--;
        repaint();
    }

    void setAlarm(long l)
    {
        seconds = l;
        repaint();
    }

    long seconds;
    Clock master;
    Container where;
    int width;
    int height;

    GraphicalClock(Clock clock1, Container container, Rectangle rectangle)
    {
        setBounds(rectangle);
        master = clock1;
        where = container;
    }
}
