import java.awt.*;
 import java.awt.event.*;
 import java.awt.geom.*;
 import javax.swing.*;
 import java.net.*;
 import java.io.*;
 import java.awt.Graphics;
 import java.util.*;
 import java.text.*;
 import java.util.Locale;

 class clock1 extends Thread
 {
 JFrame a;
 public clock1(JFrame ai)
 {a=ai;}

 public void run()
 {
 while(true)
 {
 a.validate();
 a.repaint();
 try {Thread.sleep(1000);}
 catch(InterruptedException e)
 {System.err.println(e.toString());}
 }
 }
 }

 public class C18E6 extends JFrame implements Serializable
 {
 JLabel jb;
 Font F;
 Date D;
 clock1 r;
 GregorianCalendar calender;

 public C18E6()
 {
 super("Digital Clock : Computer Programming");
 Container cc=getContentPane();
 jb=new JLabel("");
 F=new Font("TimesRoman",Font.BOLD,24);
 jb.setFont(F);
 // Türkiye standart (Greenwitch zamanına göre iki saat ileride)
 String[] ids = TimeZone.getAvailableIDs(+3 * 60 * 60 * 1000);
 SimpleTimeZone pdt = new SimpleTimeZone(+3 * 60 * 60 * 1000, ids[0]);
 calender=new GregorianCalendar(pdt);
 D=new Date();
 calender.setTime(D);
 r=new clock1(this);
 cc.add(jb);
 r.start();
 }

 public void paint(Graphics g)
 {
     D=new Date();
     calender.setTime(D);
     String s="      ["+
     calender.get(Calendar.DATE) +" / "+
     (calender.get(Calendar.MONTH)+1)+" / "+
     calender.get(Calendar.YEAR) +" ] "+
     calender.get(Calendar.HOUR_OF_DAY)+" : "+
     calender.get(Calendar.MINUTE)+" : "+
     calender.get(Calendar.SECOND);
     jb.setText(s);
 }
    public static void main(String s[])
    {	 
	    C18E6 f = new C18E6();
        f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
        f.setSize(400,110);
        f.setVisible(true);        
    }
 }
