import javax.swing.*;
import java.awt.*;
//import yildizSW;
import java.awt.geom.*;
//import renk;

public class trafikIsigi1SWP extends JPanel
{
    private static int x=10;
    private static int y= 40;
    private static int h=360;
    private static int w=100;
    private static int radius=40;
    private static int hight_diff=30;
    private isikKontroluThread1 yik;

    public trafikIsigi1SWP(isikKontroluThread1 ikt)
    {
    yik=ikt;
    }

    public void paintComponent(Graphics g) {
        Graphics2D g2 = (Graphics2D)g;
        g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
        RenderingHints.VALUE_ANTIALIAS_ON);

        g2.setColor(Color.black);
        Rectangle2D dikdortgen1=new Rectangle2D.Double(x,y,w,h);
        g2.fill(dikdortgen1);
        g2.setColor(Color.white);
        Rectangle2D dikdortgen2=new Rectangle2D.Double(x-1,y-1,w+2,h+2);
        g2.draw(dikdortgen2);
        Rectangle2D dikdortgen3=new Rectangle2D.Double(x-2,y-2,w+4,h+4);
        g2.draw(dikdortgen3);
        Rectangle2D dikdortgen4=new Rectangle2D.Double(x-4,y-4,w+8,h+8);
        g2.setColor(Color.black);
        g2.draw(dikdortgen3);
        Ellipse2D elips1=new Ellipse2D.Double(x+10,y+hight_diff,radius*2,radius*2);
        Ellipse2D elips2=new Ellipse2D.Double(x+10,y+hight_diff*2+radius*2,radius*2,radius*2);
        Ellipse2D elips3=new Ellipse2D.Double(x+10,y+hight_diff*3+radius*4,radius*2,radius*2);
       switch(yik.getIsik()) {
            case 'r':
                yik.setIsik('g');
                g2.setColor(Color.lightGray);
                g2.fill(elips1);
                g2.fill(elips2);
                g2.setColor(Color.green);
                g2.fill(elips3);
                break;
            case 'y':
                yik.setIsik('r');
                g.setColor(Color.lightGray);
                g2.fill(elips2);
                g2.fill(elips3);
                g2.setColor(Color.red);
                g2.fill(elips1);
                break;
            case 'g':
                yik.setIsik('y');
                g.setColor(Color.lightGray);
                g2.fill(elips3);
                g2.fill(elips1);
                g2.setColor(Color.yellow);
                g2.fill(elips2);
                break;
        }
    }

}
