0
import java.applet.*;
import java.awt.*;
import java.util.Calendar;
import java.util.GregorianCalendar;

public class main_class extends Applet implements Runnable
{
    Thread t,t1;

    public void start()
    {
        t = new Thread(this);
        t.start();
    }

    public void run()
    {
        t1 = Thread.currentThread();
        while (t1 == t)
        {
            repaint();
            try
            {
                t1.sleep(1000);
            }
            catch (InterruptedException e)
            {
            }
        }
    }

    public void paint(Graphics g)
    {
        Calendar cal = new GregorianCalendar();
        GregorianCalendar date = new GregorianCalendar();
        int hour = (cal.get(Calendar.HOUR));
        int am_pm = (cal.get(Calendar.AM_PM));
      
        g.drawString("Current Time: "+hour, 100, 70);  
  
        if((hour >= 5 && hour <= 7)&& am_pm == 0 )
        {
           g.drawString("SubhanAllah and Subbakhair Fajir Time", 100, 100);  
        } 
        if((hour >= 12 || hour <= 3)&& am_pm == 1)
        {
            g.drawString("It's Zuhr Prayer Time", 100, 100);      
        }
        if((hour >= 5 && hour <= 7)&& am_pm == 1)
        {          
            g.drawString("SubhanAllah it's Mughrib Time", 100, 100);  
        } 
    }
}

Post a Comment

 
Top