//////////////////////////////////////////////////////////////////////////////////////////////////// 
///////////////////////////////////////
// Java Clock Applet / I-ichirow Suzuki
// 

import java.applet.Applet;
import java.awt.*;
import java.util.Date;
//--------------------------------------------------------------------------------------------------
public class JClock extends Applet implements Runnable
{
    Thread thread;
    Image imgDoubleBuffer;
    Image imgClock;
    Graphics grphDoubleBuffer;
    boolean flagHour;
    boolean flagDate;
    boolean flagMonth;
    boolean flagDay;
    Date oldDate;
    int nDiffDate;
    int nDiffMonth;
    int nDiffDay;
	//-------------------------------------------------
    public JClock()
    {
    }
	//-------------------------------------------------
    public void init()
    {
        String as[] = {
            "S", "M", "T", "W", "T", "F", "S"
        };
        int k13 = size().width / 2;
        int l13 = size().height / 2;
        imgDoubleBuffer = createImage(size().width, size().height);
        grphDoubleBuffer = imgDoubleBuffer.getGraphics();
        imgClock = createImage(size().width, size().height);
        Graphics g = imgClock.getGraphics();
        g.setFont(new Font(g.getFont().getName(), 0, 12));
        g.setColor(new Color(183, 183, 183));
        g.fillRect(0, 0, size().width, size().height);
        g.setColor(new Color(73, 73, 73));
        g.drawOval(0, 0, size().width - 2, size().height - 2);
        g.drawString("JAVA", (size().width / 2 - g.getFontMetrics().stringWidth(String.valueOf("JAVA")) / 2) + 3, 36);
        g.setColor(new Color(255, 255, 255));
        g.drawString("JAVA", (size().width / 2 - g.getFontMetrics().stringWidth(String.valueOf("JAVA")) / 2) + 2, 35);
        g.drawOval(2, 2, size().width - 2, size().height - 2);
        g.translate(size().width / 2, size().height / 2);
        g.setColor(new Color(73, 73, 73));
        int i14 = g.getFontMetrics().getHeight();
        for(int i = 1; i <= 6; i++)
        {
            int j3 = (new Double(Math.cos((3.1415926535897931D * (double)i) / 9D - 1.5707963267948966D) * (double)(k13 - 15))).intValue();
            int j7 = (new Double(Math.sin((3.1415926535897931D * (double)i) / 9D - 1.5707963267948966D) * (double)(l13 - 15))).intValue();
            int j11 = g.getFontMetrics().stringWidth(String.valueOf(i));
            g.drawString(String.valueOf(i), (j3 - j11 / 2) + 1, j7 + i14 / 2 + 1);
        }
        for(int j = 6; j <= 12; j++)
        {
            int k3 = (new Double(Math.cos((3.1415926535897931D * (double)j) / 9D + 0.52359877559829882D) * (double)(k13 - 15))).intValue();
            int k7 = (new Double(Math.sin((3.1415926535897931D * (double)j) / 9D + 0.52359877559829882D) * (double)(l13 - 15))).intValue();
            int k11 = g.getFontMetrics().stringWidth(String.valueOf(j));
            g.drawString(String.valueOf(j), (k3 - k11 / 2) + 1, k7 + i14 / 2 + 1);
        }
        for(int k = 0; k < 12; k++)
            if(k != 6)
            {
                int l3 = (new Double(Math.cos((3.1415926535897931D * (double)k) / 6D - 1.5707963267948966D) * (double)(k13 - 7))).intValue();
                int l7 = (new Double(Math.sin((3.1415926535897931D * (double)k) / 6D - 1.5707963267948966D) * (double)(l13 - 7))).intValue();
                g.drawOval(l3 - 1, l7 - 1, 1, 1);
            }
        g.setColor(new Color(255, 255, 255));
        for(int l = 1; l <= 6; l++)
        {
            int i4 = (new Double(Math.cos((3.1415926535897931D * (double)l) / 9D - 1.5707963267948966D) * (double)(k13 - 15))).intValue();
            int i8 = (new Double(Math.sin((3.1415926535897931D * (double)l) / 9D - 1.5707963267948966D) * (double)(l13 - 15))).intValue();
            int l11 = g.getFontMetrics().stringWidth(String.valueOf(l));
            g.drawString(String.valueOf(l), i4 - l11 / 2 - 1, (i8 + i14 / 2) - 1);
        }
        for(int i1 = 6; i1 <= 12; i1++)
        {
            int j4 = (new Double(Math.cos((3.1415926535897931D * (double)i1) / 9D + 0.52359877559829882D) * (double)(k13 - 15))).intValue();
            int j8 = (new Double(Math.sin((3.1415926535897931D * (double)i1) / 9D + 0.52359877559829882D) * (double)(l13 - 15))).intValue();
            int i12 = g.getFontMetrics().stringWidth(String.valueOf(i1));
            g.drawString(String.valueOf(i1), j4 - i12 / 2 - 1, (j8 + i14 / 2) - 1);
        }
        for(int j1 = 0; j1 < 12; j1++)
            if(j1 != 6)
            {
                int k4 = (new Double(Math.cos((3.1415926535897931D * (double)j1) / 6D - 1.5707963267948966D) * (double)(k13 - 7))).intValue();
                int k8 = (new Double(Math.sin((3.1415926535897931D * (double)j1) / 6D - 1.5707963267948966D) * (double)(l13 - 7))).intValue();
                g.drawOval(k4, k8, 1, 1);
            }
        g.setColor(new Color(153, 153, 153));
        for(int k1 = 1; k1 <= 6; k1++)
        {
            int l4 = (new Double(Math.cos((3.1415926535897931D * (double)k1) / 9D - 1.5707963267948966D) * (double)(k13 - 15))).intValue();
            int l8 = (new Double(Math.sin((3.1415926535897931D * (double)k1) / 9D - 1.5707963267948966D) * (double)(l13 - 15))).intValue();
            int j12 = g.getFontMetrics().stringWidth(String.valueOf(k1));
            g.drawString(String.valueOf(k1), l4 - j12 / 2, l8 + i14 / 2);
        }
        for(int l1 = 6; l1 <= 12; l1++)
        {
            int i5 = (new Double(Math.cos((3.1415926535897931D * (double)l1) / 9D + 0.52359877559829882D) * (double)(k13 - 15))).intValue();
            int i9 = (new Double(Math.sin((3.1415926535897931D * (double)l1) / 9D + 0.52359877559829882D) * (double)(l13 - 15))).intValue();
            int k12 = g.getFontMetrics().stringWidth(String.valueOf(l1));
            g.drawString(String.valueOf(l1), i5 - k12 / 2, i9 + i14 / 2);
        }
        for(int i2 = 0; i2 < 12; i2++)
            if(i2 != 6)
            {
                int j5 = (new Double(Math.cos((3.1415926535897931D * (double)i2) / 6D - 1.5707963267948966D) * (double)(k13 - 7))).intValue();
                int j9 = (new Double(Math.sin((3.1415926535897931D * (double)i2) / 6D - 1.5707963267948966D) * (double)(l13 - 7))).intValue();
                g.drawLine(j5, j9, j5, j9);
            }
        for(int j2 = 0; j2 < 60; j2++)
            if(j2 % 5 != 0 && (j2 < 25 || j2 > 35))
            {
                int k5 = (new Double(Math.cos((3.1415926535897931D * (double)j2) / 30D - 1.5707963267948966D) * (double)(size().width / 2 - 7))).intValue();
                int k9 = (new Double(Math.sin((3.1415926535897931D * (double)j2) / 30D - 1.5707963267948966D) * (double)(size().height / 2 - 7))).intValue();
                g.setColor(new Color(73, 73, 73));
                g.drawLine(k5 - 1, k9 - 1, k5 - 1, k9 - 1);
                g.setColor(new Color(255, 255, 255));
                g.drawLine(k5, k9, k5, k9);
            }
        g.translate(0, size().height / 4);
        g.setColor(new Color(73, 73, 73));
        g.drawOval(-(size().width / 4 - 5), -(size().height / 4 - 5), size().width / 2 - 10, size().height / 2 - 10);
        g.setColor(new Color(255, 255, 255));
        g.drawOval(-(size().width / 4 - 5) + 1, -(size().height / 4 - 5) + 1, size().width / 2 - 10, size().height / 2 - 10);
        for(int k2 = 1; k2 <= 31; k2++)
            if(k2 % 10 == 1 && k2 != 1)
            {
                g.setColor(new Color(73, 73, 73));
                int l5 = (new Double(Math.cos((3.1415926535897931D * (double)k2 * 2D) / 31D - 1.5707963267948966D) * (double)(k13 / 2 - 15))).intValue();
                int l9 = (new Double(Math.sin((3.1415926535897931D * (double)k2 * 2D) / 31D - 1.5707963267948966D) * (double)(l13 / 2 - 15))).intValue();
                int l12 = g.getFontMetrics().stringWidth(String.valueOf(k2));
                g.drawString(String.valueOf(k2), (l5 - l12 / 2) + 1, l9 + i14 / 2 + 1);
                g.setColor(new Color(255, 255, 255));
                g.drawString(String.valueOf(k2), l5 - l12 / 2, l9 + i14 / 2);
            } else
            {
                g.setColor(new Color(73, 73, 73));
                int i6 = (new Double(Math.cos((3.1415926535897931D * (double)k2 * 2D) / 31D - 1.5707963267948966D) * (double)(k13 / 2 - 8))).intValue();
                int i10 = (new Double(Math.sin((3.1415926535897931D * (double)k2 * 2D) / 31D - 1.5707963267948966D) * (double)(l13 / 2 - 8))).intValue();
                g.drawLine(i6, i10, i6, i10);
                g.setColor(new Color(255, 255, 255));
                g.drawLine(i6 + 1, i10 + 1, i6 + 1, i10 + 1);
            }
        g.translate(-size().width / 2, (-size().height * 3) / 4);
        g.translate((new Double(Math.cos(-0.52359877559829882D) * (double)(size().width / 6))).intValue() + size().width / 2 + 5, (new Double(Math.sin(-0.52359877559829882D) * (double)(size().height / 6))).intValue() + size().height / 2 + 5);
        g.setColor(new Color(73, 73, 73));
        g.drawOval(-size().width / 8 - 1, -size().height / 8 - 1, size().width / 4, size().height / 4);
        g.setColor(new Color(255, 255, 255));
        g.drawOval(-size().width / 8, -size().height / 8, size().width / 4, size().height / 4);
        for(int l2 = 1; l2 <= 12; l2++)
            if(l2 % 3 == 0)
            {
                int j6 = (new Double(Math.cos((3.1415926535897931D * (double)l2) / 6D - 1.5707963267948966D) * (double)(size().width / 8 - 7))).intValue();
                int j10 = (new Double(Math.sin((3.1415926535897931D * (double)l2) / 6D - 1.5707963267948966D) * (double)(size().height / 8 - 7))).intValue();
                int i13 = g.getFontMetrics().stringWidth(String.valueOf(l2));
                g.setColor(new Color(73, 73, 73));
                g.drawString(String.valueOf(l2), (j6 - i13 / 2) + 1, j10 + i14 / 2 + 1);
                g.setColor(new Color(255, 255, 255));
                g.drawString(String.valueOf(l2), j6 - i13 / 2, j10 + i14 / 2);
            } else
            {
                int k6 = (new Double(Math.cos((3.1415926535897931D * (double)l2 * 2D) / 7D - 1.5707963267948966D) * (double)(size().width / 8 - 3))).intValue();
                int k10 = (new Double(Math.sin((3.1415926535897931D * (double)l2 * 2D) / 7D - 1.5707963267948966D) * (double)(size().height / 8 - 3))).intValue();
                g.setColor(new Color(73, 73, 73));
                g.drawLine(k6 - 1, k10 - 1, k6 - 1, k10 - 1);
                g.setColor(new Color(255, 255, 255));
                g.drawLine(k6, k10, k6, k10);
            }
        g.translate(-size().width / 3 - 4, 0);
        g.setColor(new Color(73, 73, 73));
        g.drawOval(-size().width / 8 - 1, -size().height / 8 - 1, size().width / 4, size().height / 4);
        g.setColor(new Color(255, 255, 255));
        g.drawOval(-size().width / 8, -size().height / 8, size().width / 4, size().height / 4);
        for(int i3 = 0; i3 < 7; i3++)
            if(i3 == 0 || i3 == 2 || i3 == 5)
            {
                int l6 = (new Double(Math.cos((3.1415926535897931D * (double)i3 * 2D) / 7D - 1.5707963267948966D) * (double)(size().width / 8 - 7))).intValue();
                int l10 = (new Double(Math.sin((3.1415926535897931D * (double)i3 * 2D) / 7D - 1.5707963267948966D) * (double)(size().height / 8 - 7))).intValue();
                int j13 = g.getFontMetrics().stringWidth(as[i3]);
                g.setColor(new Color(73, 73, 73));
                g.drawString(as[i3], (l6 - j13 / 2) + 1, l10 + i14 / 2 + 1);
                g.setColor(new Color(255, 255, 255));
                g.drawString(as[i3], l6 - j13 / 2, l10 + i14 / 2);
            } else
            {
                int i7 = (new Double(Math.cos((3.1415926535897931D * (double)i3 * 2D) / 7D - 1.5707963267948966D) * (double)(size().width / 8 - 3))).intValue();
                int i11 = (new Double(Math.sin((3.1415926535897931D * (double)i3 * 2D) / 7D - 1.5707963267948966D) * (double)(size().height / 8 - 3))).intValue();
                g.setColor(new Color(73, 73, 73));
                g.drawLine(i7 - 1, i11 - 1, i7 - 1, i11 - 1);
                g.setColor(new Color(255, 255, 255));
                g.drawLine(i7, i11, i7, i11);
            }
        oldDate = new Date();
        flagHour = false;
        flagDate = false;
        flagMonth = false;
    }
	//-------------------------------------------------
    public void start()
    {
        if(thread == null)
        {
            thread = new Thread(this);
            thread.start();
        }
    }
	//-------------------------------------------------
    public void stop()
    {
        if(thread != null)
        {
            thread.stop();
            thread = null;
        }
    }
	//-------------------------------------------------
    public void run()
    {
        do
        {
            try
            {
                Thread.sleep(50L);
            }
            catch(InterruptedException _ex)
            {
                return;
            }
            repaint();
        } while(true);
    }
	//-------------------------------------------------
    public void update(Graphics g)
    {
        paint(g);
    }
	//-------------------------------------------------
    public void paint(Graphics g)
    {
        Date date = new Date();
        int i = size().width / 2;
        int j = i + 2;
        int k = size().height / 2;
        int l = k + 2;
        double d = (new Long(date.getTime() % 1000L)).doubleValue();
        double d1 = (new Integer(date.getSeconds())).doubleValue();
        double d2 = (new Integer(date.getMinutes())).doubleValue();
        double d3 = (new Integer(date.getHours())).doubleValue();
        grphDoubleBuffer.drawImage(imgClock, 0, 0, this);
        grphDoubleBuffer.setColor(new Color(0, 0, 0));
        grphDoubleBuffer.fillOval(size().width / 2 - 4, (size().height * 3) / 4 - 4, 8, 8);
        grphDoubleBuffer.fillOval((new Double((Math.cos(-0.52359877559829882D) * (double)size().width) / 6D)).intValue() + size().width / 2 + 3, (new Double(Math.sin(-0.52359877559829882D) * (double)(size().height / 6))).intValue() + size().height / 2 + 3, 6, 6);
        grphDoubleBuffer.fillOval(((new Double((Math.cos(-0.52359877559829882D) * (double)size().width) / 6D)).intValue() + size().width / 2) - size().width / 3 - 1, (new Double(Math.sin(-0.52359877559829882D) * (double)(size().height / 6))).intValue() + size().height / 2 + 3, 6, 6);
        grphDoubleBuffer.setColor(new Color(153, 153, 153));
        grphDoubleBuffer.fillOval(size().width / 2 - 2, (size().height * 3) / 4 - 2, 4, 4);
        grphDoubleBuffer.fillOval((new Double((Math.cos(-0.52359877559829882D) * (double)size().width) / 6D)).intValue() + size().width / 2 + 4, (new Double(Math.sin(-0.52359877559829882D) * (double)(size().height / 6))).intValue() + size().height / 2 + 4, 3, 3);
        grphDoubleBuffer.fillOval(((new Double((Math.cos(-0.52359877559829882D) * (double)size().width) / 6D)).intValue() + size().width / 2) - size().width / 3, (new Double(Math.sin(-0.52359877559829882D) * (double)(size().height / 6))).intValue() + size().height / 2 + 4, 3, 3);
        double d4 = (3.1415926535897931D * (d1 + d / 1000D) * 6D) / 180D - 1.5707963267948966D;
        int i1 = (new Double(Math.cos(d4) * (double)(size().width / 2 - 5))).intValue();
        int j3 = (new Double(Math.sin(d4) * (double)(size().height / 2 - 5))).intValue();
        int k5 = (new Double(Math.cos(3.1415926535897931D + d4) * 10D)).intValue();
        int j6 = (new Double(Math.sin(3.1415926535897931D + d4) * 10D)).intValue();
        grphDoubleBuffer.setColor(new Color(123, 123, 123));
        grphDoubleBuffer.drawLine(j, l, i1 + j, j3 + l);
        grphDoubleBuffer.drawLine(j, l, k5 + j, j6 + l);
        grphDoubleBuffer.setColor(new Color(0, 0, 0));
        grphDoubleBuffer.drawLine(i, k, i1 + i, j3 + k);
        grphDoubleBuffer.drawLine(i, k, k5 + i, j6 + k);
        d4 = (3.1415926535897931D * (d2 + d1 / 60D + d / 60000D) * 6D) / 180D - 1.5707963267948966D;
        double d12 = Math.cos(d4);
        double d15 = Math.sin(d4);
        i1 = (new Double(d12 * (double)(i - 11))).intValue();
        j3 = (new Double(d15 * (double)(k - 11))).intValue();
        k5 = (new Double(d12 * (double)(i - 7))).intValue();
        j6 = (new Double(d15 * (double)(k - 7))).intValue();
        int i7 = (new Double(d12 * (double)(i - 5))).intValue();
        int l7 = (new Double(d15 * (double)(k - 5))).intValue();
        int k8 = (new Double(d12 * (double)(i - 9))).intValue();
        int j9 = (new Double(d15 * (double)(k - 9))).intValue();
        grphDoubleBuffer.setColor(new Color(123, 123, 123));
        grphDoubleBuffer.drawLine(j, l, i1 + j, j3 + l);
        grphDoubleBuffer.drawLine(k5 + j, j6 + l, i7 + j, l7 + l);
        grphDoubleBuffer.drawOval((k8 + j) - 2, (j9 + j) - 2, 4, 4);
        grphDoubleBuffer.setColor(new Color(0, 0, 0));
        grphDoubleBuffer.drawLine(i, k, i1 + i, j3 + k);
        grphDoubleBuffer.drawLine(k5 + i, j6 + k, i7 + i, l7 + k);
        grphDoubleBuffer.drawOval((k8 + i) - 2, (j9 + i) - 2, 4, 4);
        if(d3 > 12D)
            d3 -= 12D;
        if(!flagHour)
        {
            if(date.getHours() != oldDate.getHours() && d3 == 6D)
                flagHour = true;
            if(d3 < 6D || flagHour)
                d4 = (3.1415926535897931D * (d3 + d2 / 60D + d1 / 3600D + d / 3600000D) * 20D) / 180D - 1.5707963267948966D;
            else
            if(d3 >= 6D)
                d4 = ((3.1415926535897931D * (d3 + d2 / 60D + d1 / 3600D + d / 3600000D) * 20D) / 180D - 1.5707963267948966D) + 2.0943951023931953D;
            double d13 = Math.cos(d4);
            double d16 = Math.sin(d4);
            int j1 = (new Double(d13 * (double)(i - 31))).intValue();
            int k3 = (new Double(d16 * (double)(k - 31))).intValue();
            int l5 = (new Double(d13 * (double)(i - 27))).intValue();
            int k6 = (new Double(d16 * (double)(k - 27))).intValue();
            int j7 = (new Double(d13 * (double)(i - 25))).intValue();
            int i8 = (new Double(d16 * (double)(k - 25))).intValue();
            int l8 = (new Double(d13 * (double)(i - 29))).intValue();
            int k9 = (new Double(d16 * (double)(k - 29))).intValue();
            grphDoubleBuffer.setColor(new Color(123, 123, 123));
            grphDoubleBuffer.drawLine(j, l, j1 + j, k3 + l);
            grphDoubleBuffer.drawLine(l5 + j, k6 + l, j7 + j, i8 + l);
            grphDoubleBuffer.drawOval((l8 + j) - 2, (k9 + j) - 2, 4, 4);
            grphDoubleBuffer.setColor(new Color(0, 0, 0));
            grphDoubleBuffer.drawLine(i, k, j1 + i, k3 + k);
            grphDoubleBuffer.drawLine(l5 + i, k6 + k, j7 + i, i8 + k);
            grphDoubleBuffer.drawOval((l8 + i) - 2, (k9 + i) - 2, 4, 4);
        } else
        if(d1 > 12D)
        {
            flagHour = false;
        } else
        {
            double d5 = (3.1415926535897931D * (6D - (d1 + d / 1000D)) * 20D) / 180D - 1.5707963267948966D;
            double d14 = Math.cos(d5);
            double d17 = Math.sin(d5);
            int k1 = (new Double(d14 * (double)(i - 31))).intValue();
            int l3 = (new Double(d17 * (double)(k - 31))).intValue();
            int i6 = (new Double(d14 * (double)(i - 27))).intValue();
            int l6 = (new Double(d17 * (double)(k - 27))).intValue();
            int k7 = (new Double(d14 * (double)(i - 25))).intValue();
            int j8 = (new Double(d17 * (double)(k - 25))).intValue();
            int i9 = (new Double(d14 * (double)(i - 29))).intValue();
            int l9 = (new Double(d17 * (double)(k - 29))).intValue();
            grphDoubleBuffer.setColor(new Color(123, 123, 123));
            grphDoubleBuffer.drawLine(j, l, k1 + j, l3 + l);
            grphDoubleBuffer.drawLine(i6 + j, l6 + l, k7 + j, j8 + l);
            grphDoubleBuffer.drawOval((i9 + j) - 2, (l9 + j) - 2, 4, 4);
            grphDoubleBuffer.setColor(new Color(0, 0, 0));
            grphDoubleBuffer.drawLine(i, k, k1 + i, l3 + k);
            grphDoubleBuffer.drawLine(i6 + i, l6 + k, k7 + i, j8 + k);
            grphDoubleBuffer.drawOval((i9 + i) - 2, (l9 + i) - 2, 4, 4);
            if(d1 >= 12D)
                flagHour = false;
        }
        i = size().width / 2;
        k = (size().height * 3) / 4;
        j = size().width / 2 + 2;
        l = (size().height * 3) / 4 + 2;
        if(date.getDate() != oldDate.getDate() && !flagDate && !flagMonth && !flagDay)
        {
            if(date.getMonth() != oldDate.getMonth())
            {
                nDiffDate = 32 - oldDate.getDate();
                nDiffMonth = 1;
                flagMonth = true;
            } else
            {
                nDiffDate = date.getDate() - oldDate.getDate() - 1;
            }
            nDiffDay = 1;
            flagDate = true;
            flagDay = true;
        }
        if(!flagDate)
        {
            double d6 = (3.1415926535897931D * (double)date.getDate() * 2D) / 31D - 1.5707963267948966D;
            int l1 = (new Double(Math.cos(d6) * (double)(size().width / 4 - 7))).intValue();
            int i4 = (new Double(Math.sin(d6) * (double)(size().height / 4 - 7))).intValue();
            grphDoubleBuffer.setColor(new Color(123, 123, 123));
            grphDoubleBuffer.drawLine(j, l, l1 + j, i4 + l);
            grphDoubleBuffer.setColor(new Color(0, 0, 0));
            grphDoubleBuffer.drawLine(i, k, l1 + i, i4 + k);
            if(!flagMonth && !flagDay)
                oldDate = date;
            nDiffDate = 0;
        } else
        {
            double d7 = (3.1415926535897931D * ((double)oldDate.getDate() + (d1 + d / 1000D)) * 2D) / 31D - 1.5707963267948966D;
            int i2 = (new Double(Math.cos(d7) * (double)(size().width / 4 - 7))).intValue();
            int j4 = (new Double(Math.sin(d7) * (double)(size().height / 4 - 7))).intValue();
            grphDoubleBuffer.setColor(new Color(123, 123, 123));
            grphDoubleBuffer.drawLine(j, l, i2 + j, j4 + l);
            grphDoubleBuffer.setColor(new Color(0, 0, 0));
            grphDoubleBuffer.drawLine(i, k, i2 + i, j4 + k);
            if((double)nDiffDate <= d1)
            {
                flagDate = false;
                if(!flagMonth && !flagDay)
                    oldDate = date;
                nDiffDate = 0;
            }
        }
        i = (new Double((Math.cos(-0.52359877559829882D) * (double)size().width) / 6D)).intValue() + size().width / 2 + 5;
        k = (new Double(Math.sin(-0.52359877559829882D) * (double)(size().height / 6))).intValue() + size().height / 2 + 5;
        j = i + 1;
        l = k + 1;
        if(!flagMonth)
        {
            double d8 = (3.1415926535897931D * (double)(date.getMonth() + 1)) / 6D - 1.5707963267948966D;
            int j2 = (new Double(Math.cos(d8) * (double)(size().width / 8 - 3))).intValue();
            int k4 = (new Double(Math.sin(d8) * (double)(size().height / 8 - 3))).intValue();
            grphDoubleBuffer.setColor(new Color(123, 123, 123));
            grphDoubleBuffer.drawLine(j, l, j2 + j, k4 + l);
            grphDoubleBuffer.setColor(new Color(0, 0, 0));
            grphDoubleBuffer.drawLine(i, k, j2 + i, k4 + k);
            if(!flagDate && !flagDay)
                oldDate = date;
            nDiffMonth = 0;
        } else
        {
            double d9 = (3.1415926535897931D * ((double)(oldDate.getMonth() + 1) + (d1 + d / 1000D))) / 6D - 1.5707963267948966D;
            int k2 = (new Double(Math.cos(d9) * (double)(size().width / 8 - 3))).intValue();
            int l4 = (new Double(Math.sin(d9) * (double)(size().height / 8 - 3))).intValue();
            grphDoubleBuffer.setColor(new Color(123, 123, 123));
            grphDoubleBuffer.drawLine(j, l, k2 + j, l4 + l);
            grphDoubleBuffer.setColor(new Color(0, 0, 0));
            grphDoubleBuffer.drawLine(i, k, k2 + i, l4 + k);
            if((double)nDiffMonth <= d1)
            {
                flagMonth = false;
                if(!flagDate && !flagDay)
                    oldDate = date;
                nDiffMonth = 0;
            }
        }
        i = (((new Double((Math.cos(-0.52359877559829882D) * (double)size().width) / 6D)).intValue() + size().width / 2) - size().width / 3) + 1;
        k = (new Double(Math.sin(-0.52359877559829882D) * (double)(size().height / 6))).intValue() + size().height / 2 + 5;
        j = i + 1;
        l = k + 1;
        if(!flagDay)
        {
            double d10 = (3.1415926535897931D * (double)date.getDay() * 2D) / 7D - 1.5707963267948966D;
            int l2 = (new Double(Math.cos(d10) * (double)(size().width / 8 - 3))).intValue();
            int i5 = (new Double(Math.sin(d10) * (double)(size().height / 8 - 3))).intValue();
            grphDoubleBuffer.setColor(new Color(123, 123, 123));
            grphDoubleBuffer.drawLine(j, l, l2 + j, i5 + l);
            grphDoubleBuffer.setColor(new Color(0, 0, 0));
            grphDoubleBuffer.drawLine(i, k, l2 + i, i5 + k);
            if(!flagDate && !flagMonth)
                oldDate = date;
            nDiffDay = 0;
        } else
        {
            double d11 = (3.1415926535897931D * ((double)oldDate.getDay() + (d1 + d / 1000D)) * 2D) / 7D - 1.5707963267948966D;
            int i3 = (new Double(Math.cos(d11) * (double)(size().width / 8 - 3))).intValue();
            int j5 = (new Double(Math.sin(d11) * (double)(size().height / 8 - 3))).intValue();
            grphDoubleBuffer.setColor(new Color(123, 123, 123));
            grphDoubleBuffer.drawLine(j, l, i3 + j, j5 + l);
            grphDoubleBuffer.setColor(new Color(0, 0, 0));
            grphDoubleBuffer.drawLine(i, k, i3 + i, j5 + k);
            if((double)nDiffDay <= d1)
            {
                flagDay = false;
                if(!flagDate && !flagMonth)
                    oldDate = date;
                nDiffDay = 0;
            }
        }
        grphDoubleBuffer.setColor(new Color(0, 0, 0));
        grphDoubleBuffer.fillOval(size().width / 2 - 4, size().height / 2 - 4, 8, 8);
        grphDoubleBuffer.setColor(new Color(153, 153, 153));
        grphDoubleBuffer.fillOval(size().width / 2 - 2, size().height / 2 - 2, 4, 4);
        g.drawImage(imgDoubleBuffer, 0, 0, this);
    }
}