Tengo una aplicación hecha en hilos y me ha surgido un problema.
En la aplicación (MAIN) tengo lo siguiente.
Código PHP:
   // Añadimos los botones de interacción que podrá usar el usuario
        Ejecutar = new JButton();
        Ejecutar.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                //timer2.start();
                quitarAlways(false);
                C = new Contador();
                Hilo = new Thread(C);
                Hilo.start();
                while (C.isRunning()){
                    
                }
                timer2.start();
                /*while (C.mRun==false){
                }
                timer2.start();
                }*/
            }
        });
        Ejecutar.setText("Ejecutar");
        Ejecutar.setBounds(10, 230, 82, 23);
        contentPane.add(Ejecutar); 
    Código PHP:
   package AutoClick2;
 
import java.awt.Dimension;
 
@SuppressWarnings("serial")
public class Contador extends JFrame implements Runnable, ActionListener {
    private boolean continuar = true;
    public boolean  mRun=true;
    int t=5;
    private JLabel PosicioneElPuntero;
    private JLabel c;
    /**
     * Launch the application.
     */
    public static void main(String[] args) {
        /*Contador c = new Contador();
        Thread Hilo = new Thread(c);
        Hilo.start();*/
    }
    /**
     * Create the frame.
     */
    public Contador() {
        this.objs();
        // Propiedades del JFrame
        this.setTitle("Contador");
        this.setLocation(new Point(580, 280));
        this.setSize(new Dimension(209,110));
        this.setVisible(true);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setResizable(false);
        this.getContentPane().setLayout(null);
    }
 
    public void objs() {
        c = new JLabel(""+t);
        c.setBounds(100,11,60,20);
        getContentPane().add(c);
        
        PosicioneElPuntero = new JLabel("Posicione el puntero de su ratón");
        PosicioneElPuntero.setBounds(10, 42, 191, 14);
        getContentPane().add(PosicioneElPuntero);
    }
    
    public void detenElHilo() throws InterruptedException{
        continuar=false;
        mRun = false;
        dispose();
    }
 
    public boolean isRunning(){
        return mRun;
    }
    
    public void run (){
        try {
            while (continuar==true){
                t-=1;
                c.setText(""+t);
                Thread.sleep(1000);
                if (t==0){
                    detenElHilo();
                }
            }
        }catch (Exception e){}
    }
    public void actionPerformed(ActionEvent arg0) {
    }
} 
    
 

