import java.applet.Applet;
import java.awt.Button;
import java.awt.TextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class chronometer extends Applet implements ActionListener, Runnable {
	String s,str;
	TextField lab;
	int count;
	Thread thr;

	public void init() {
	  Button but = new Button("Χρονόμετρο");
	  add(but);
	  but.addActionListener(this);
	  lab = new TextField(" ",20);
	  add(lab);
	}
		
	public void actionPerformed(ActionEvent e) {
	  str = e.getActionCommand();
	  Thread thr = new Thread(this);
	  thr.start();
	}
		
	public void start() {
	  count = 4;
	  s = " ";
	}

	public void stop() {
	  thr = null;
	}

	@Override
	public void run() {
	  while (count>0) {
		--count;
		s = String.valueOf(count);
		lab.setText(s);
		showStatus(s);
		repaint();
		try {
		  Thread.sleep(10000);
		}
	catch (InterruptedException e) {
		  showStatus("Διακόπηκε");
		}
	  }	
	}
}





