Questions
Please write a custom component that acts as a simple stop-watch. Specifically, when the user clicks on it, this component starts timing; when the user clicks again, it displays the time between the two clicks; clicking a third time starts another timer, etc; while it is timing, the label displays the elapsed time since the timer was started.
1. Programs
StopWatchLabel.java
1 | import java.awt.event.*; |
StopWatchLabelTest.java
1 | import javax.swing.*; |
2. Outputs
Before timing:
During timing:


After timing: