Skip to content
Snippets Groups Projects
StopWatch.java 890 B
Newer Older
  • Learn to ignore specific revisions
  • Dániel's avatar
    Dániel committed
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    package GUI.game;
    
    import java.util.logging.Level;
    import java.util.logging.Logger;
    
    /**
     *
     * @author Dániel
     */
    public class StopWatch extends Thread
    {
        private Controller controller;
        private int time;
        
        public StopWatch(Controller controller)
        {
            this.controller  = controller;
        }
        
        @Override
        public void run()
        {
            synchronized(this.controller)
            {
                while( true )
                {            
                    try 
                    {
    
                        controller.timeLeft();
                        sleep(1000);
                    } catch (InterruptedException ex) 
                    {
                        System.out.println("int error");
                    }
                }
            }
        }
    }