Solved

Java StopWatch

Posted on 2007-04-05
8
3,591 Views
Last Modified: 2013-11-23
I need to write an interactive application(java) to simulate a stop watch. The start button will cause the display every 1/2 second(500 milliseconds) A stop button and the elapsed time will be displayed. A third clear button will reset all to zero. 3 buttons and two labels. I need code ASAP! Stopwatch code and Stopwatchtester.
0
Comment
Question by:mack04
8 Comments
 
LVL 15

Expert Comment

by:JakobA
ID: 18862478
Are you asking about the programming language Jave or about the scripting language JavaScript ? It is 2 very different languages.
0
 
LVL 11

Expert Comment

by:Manish
ID: 18862612
I think, you need to learn swing or applet.
0
 
LVL 29

Expert Comment

by:Badotz
ID: 18862906
HOMEWORK! AAARRRGGGHHH!
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:mack04
ID: 18862995
I need to write an interactive application(java) to simulate a stop watch. The start button will cause the display every 1/2 second(500 milliseconds) A stop button and the elapsed time will be displayed. A third clear button will reset all to zero. 3 buttons and two labels. I need code ASAP! Stopwatch code and Stopwatchtester. (java programming language-not javascript) I'm on travel for my job and will not have time to work on it.
0
 
LVL 1

Expert Comment

by:Matty023
ID: 18863563
"The start button will cause the display every 1/2 second(500 milliseconds)"

Will cause the display to do what?

0
 
LVL 30

Accepted Solution

by:
Mayank S earned 500 total points
ID: 18864102
Sorry we can't provide you full code. It is against site rules.

Have a look at Swing for developing the UI -http://www.exampledepot.com/egs/javax.swing/pkg.html

You can create a JFrame and add buttons/ labels to it using the examples on that page. You can write action event listeners for the buttons:

http://www.exampledepot.com/egs/java.awt.event/ActionEvents.html

Then you need to create, stop and reset timers based on the button which was clilcked, in their respective event handlers:

http://www.exampledepot.com/egs/java.util/pkg.html#Timers
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

948 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now