import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class isikKontroluThread1 extends Thread
{
JFrame a;
public double yesilZaman;
public double kirmiziZaman;
public double sariZaman;
public char hangi_isik;

   public isikKontroluThread1(JFrame ai)
   {
   a=ai;
   yesilZaman=5.0;
   kirmiziZaman=5.0;
   sariZaman=1.0;
   hangi_isik='y';
   }

   public void run()
   {
   while(true)
   {
    a.repaint();

    try {
        if(hangi_isik=='r')
           {
           Thread.sleep((int)(kirmiziZaman*1000));
           }
        }
    catch(InterruptedException e)
    {System.err.println(e.toString());}

    try {
        if(hangi_isik=='g')
           {
           Thread.sleep((int)(yesilZaman*1000));
           }
        }
    catch(InterruptedException e)
    {System.err.println(e.toString());}
    try {
        if(hangi_isik=='y')
           {
           Thread.sleep((int)(sariZaman*1000));
           }
        }
    catch(InterruptedException e)
    {System.err.println(e.toString());}
   }
   }

   public void setYesilZaman(double zi)
   {
     yesilZaman=zi;
   }

   public void setKirmiziZaman(double zi)
   {
     kirmiziZaman=zi;
   }

   public void setSariZaman(double zi)
   {
     sariZaman=zi;
   }

   public double getYesilZaman()
   {
     return yesilZaman;
   }

   public double getKirmiziZaman()
   {
     return kirmiziZaman;
   }

   public double getSariZaman()
   {
     return sariZaman;
   }

   public char getIsik()
   {
     return hangi_isik;
   }

   public void setIsik(char hi)
   {
     hangi_isik=hi;
   }

}

