
public class ClockBean extends Thread {
	// how to format the time for this locale
	java.text.DateFormat f =
		java.text.DateFormat.getTimeInstance(
			java.text.DateFormat.MEDIUM);
	boolean keepRunning = true;
	boolean isRunning = true;

	public ClockBean() { start(); }
	public void run() {
		while( keepRunning ) {
			if ( isRunning ) {
				// get current time
				String time = f.format(new java.util.Date());
				System.out.println( time );
			}
			try {
				Thread.sleep( 1000 );
			} catch (InterruptedException e) {}
		}
	}
	public void terminate() { keepRunning = false; }
	public void stopClock() { isRunning = false; }
	public void startClock() { isRunning = true; }
}
				

