import java.awt.Graphics;
 import java.awt.*;
 import java.util.*;
 import javax.swing.*;
 import java.text.*;


 public class saatRunnableSWF extends JFrame implements Runnable
 {
 JLabel jb;
 Font F;
 Date D;
 saatThreadSWF r;
 GregorianCalendar takvim;
 Thread runner;


 public saatRunnableSWF()
 {
 super("Digital Saat Runnable implement Thread");
 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(+2 * 60 * 60 * 1000);
 SimpleTimeZone pdt = new SimpleTimeZone(+2 * 60 * 60 * 1000, ids[0]);
 takvim=new GregorianCalendar(pdt);
 D=new Date();
 takvim.setTime(D);
 setBackground(renk.beyaz);
 r=new saatThreadSWF(this);
 cc.add(jb);
 r.start();
 }

    public void start()
    {
        if(runner==null)
        {
            runner=new Thread(this);
            runner.start();
        }
    }

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


    public void paint(Graphics g)
    {
    D=new Date();
    takvim.setTime(D);
    String s="      ["+
    takvim.get(Calendar.DATE) +" / "+
    takvim.get(Calendar.MONTH)+" / "+
    takvim.get(Calendar.YEAR) +" ] "+
    takvim.get(Calendar.HOUR_OF_DAY)+" : "+
    takvim.get(Calendar.MINUTE)+" : "+
    takvim.get(Calendar.SECOND);
    jb.setText(s);
    }

      public static void main(String[] args)
      {
      saatRunnableSWF pencere= new saatRunnableSWF();
      pencere.addWindowListener(new BasicWindowMonitor());
      pencere.setSize(400,100);
      pencere.setVisible(true);
      }
 }