Solved

Java StopWatch

Posted on 2007-04-05
8
3,584 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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:
mayankeagle 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

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
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 if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

758 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

21 Experts available now in Live!

Get 1:1 Help Now