Friday, May 29, 2009

JStopWatch

JStopWatch is a simple program developed in Java programming language which has the functionality of a stop watch like start, stop, pause, resume etc. JStopWatch can be used to know the elapsed time for a particular operaion.

Two Java classes are developed for this program. JStopWatch is created for the stop watch functionality. JStopWatch has inherited the Thread class. JStopWatch has three private attributes hour, minute, second. This program continuously increase the value of second after every 1000 millisecond. In the same way, it increases the value of minute, and hour after every 60 seconds and 60 minutes respectively.

Thread class method start, suspend, resume and stop methods are used for start, pause, resume and stop the watch.

A UI class (JStopWatchUI) has been defined separately for showing the output of JStopWatch. The UI class has an inner class for updating the UI continuously based on the value of JStopWatch.

Followings are some of the screen shots:



Figure: JStopWatch before the start




Figure: JStopWatch after the start



Figure: JStopWatch after the pause



Figure: JStopWatch after the resume



Figure: JStopWatch after the stop


Downloads:

Executable Jar File : JStopWatch.jar

NetBeans Projects: JStopWatch.zip

Individual Java Source Files: JStopWatch.java , JStopWatchUI.java

0 comments:

Template by - Abdul Munir | Daya Earth Blogger Template