// Decompiled by DJ v3.12.12.96 Copyright 2011 Atanas Neshkov  Date: 08/10/2012 8:47:27
// Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   CajaDeTextoDeLasPreguntas.java

package project;

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

// Referenced classes of package project:
//            Caja, NoQuieroHacela, JLabel, PanelDelAreaInteractiva, 
//            Mensajes, BotonSiguiente

public class CajaDeTextoDeLasPreguntas extends JPanel
    implements Runnable
{

    public CajaDeTextoDeLasPreguntas(Mensajes mensajes2, BotonSiguiente bSig2, PanelDelAreaInteractiva Pdai2)
    {
        ejecutarHilo = false;
        areaDeTexto = new Caja(this);
        javax.swing.border.Border borde3 = BorderFactory.createEmptyBorder(4, 0, 0, 0);
        setBorder(borde3);
        Pdai1 = Pdai2;
        mensajes = mensajes2;
        bSig = bSig2;
        noQuieroHacela = new NoQuieroHacela(mensajes, bSig, areaDeTexto, Pdai1);
        f1 = new Font("Arial", 0, 11);
        setOpaque(false);
        setLayout(new BorderLayout());
        add(areaDeTexto, "West");
        JPanel panelSubliminal = new JPanel();
        panelSubliminal.setLayout(new BorderLayout());
        panelSubliminal.setOpaque(false);
        subliminal = new project.JLabel();
        subliminal.setForeground(Color.blue);
        subliminal.setFont(f1);
        subliminal.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
        panelSubliminal.add(subliminal, "West");
        panelSubliminal.add(noQuieroHacela, "East");
        subliminal.setVerticalAlignment(3);
        areaDeTexto.add(panelSubliminal, "South");
    }

    public Caja darCaja()
    {
        return areaDeTexto;
    }

    public void run()
    {
        Thread myThread = Thread.currentThread();
        do
        {
            if(hilo != myThread)
                break;
            try
            {
                Thread.sleep(1000L);
                if(ejecutarHilo)
                    subliminal.setForeground(new Color(165, 171, 248));
                Thread.sleep(1000L);
                if(ejecutarHilo)
                    subliminal.setForeground(new Color(0, 0, 255));
            }
            catch(InterruptedException e)
            {
                e.printStackTrace();
            }
        } while(true);
    }

    protected void pararHilo()
    {
        try
        {
            ejecutarHilo = false;
            hilo = null;
            super.finalize();
            subliminal.setForeground(new Color(0, 0, 255));
        }
        catch(Throwable e)
        {
            e.printStackTrace();
        }
    }

    protected void arrancarHilo()
    {
        ejecutarHilo = true;
        hilo = new Thread(this, "Crono");
        hilo.start();
    }

    Thread hilo;
    Font f1;
    boolean ejecutarHilo;
    PanelDelAreaInteractiva panelDelAreaInteractiva;
    Caja areaDeTexto;
    NoQuieroHacela noQuieroHacela;
    Mensajes mensajes;
    BotonSiguiente bSig;
    PanelDelAreaInteractiva Pdai1;
    project.JLabel subliminal;
}