Question: Write a Java program with a Graphical User Interface that will function as a stopwatch. The GUI only needs a button and label to display
AT&T 12:45 PM @* 100% @ D. blackboard.ncat.edu 1 of 1 COMP163 Stopwatch Program W'rite a Java peogram with a Graphical User Imerface that will function as a stopwatch. The GUI enly meeds a button and a label to display the clapsed time. . 2.81 seconds The program will need a class itstance variable called startTise to keep track of the time when the start button was pressod. This value should be a long, which is just like an int, but can stoee mch larger numbers. It should be initialized to zeo The actionPerformed method should be structured as shown below. Note in the IF statement there are two equals signs public void actionPerforsed(java . awt.event .ActionEvent thing> W create an object of the java.util.Date class W call the getTine 0 method on the Date object and save the retumed value in starttine W change the test of the bun else // create an object of the ] avaut i 1 , Date class W call the gertine (0 method on the Date object. Suberact startTine from the returned valuc to get the elapsed time. Convert the clapsed time to a double and divide by 1000 to get seconds W Display the result Wchange the test of the button set startTine to zero
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
