CSCI 136: Assignment 9 -- Timer

Due 5/15/97


In this program you are to write a program to emulate a Timer. It will have a display showing the current time as well as buttons to start the timer, pause it, and clear the time. A demo version is shown below.

The current system time in milliseconds (thousandths of a second) is available by executing System.currentTimeMillis();, which returns a longint representing the number of milliseconds since January 1, 1970. If you save the time the start button is clicked in startTime then System.currentTimeMillis() - startTime will return the number of milliseconds since the timer was started.

The method String timeString(long time) included in class WatchThread converts the milliseconds into a string suitable for showing in the display field. I have provided you with two files: Timer.java and WatchThread.java, which provide a frame and the skeleton of a class extending Thread. Please complete the solution so the program behaves like the program above.