Hi! I am new to java and I'm trying to make a Stop Clock which shows time in minutes, seconds and mili-seconds. I've attached the zip file with this thread which includes the source code and other files required to run the program. The problem which I'm facing is that as soon as I click on the start button of my stop clock the applet gets stuck and nothing happens.
Please tell me where I'm going and the way to correct it. It would be even more obliging if you give me the corrected code itself. Thanks in advance.
Ravish.Ahmad.Khan
0
Newbie Poster
Recommended Answers
Jump to PostCan't be bothered to mess around with your zip - please post code in proper format here.
But at a guess you're blocking the Swing thread...Everything to do with Swing (eg painting the screen, running actionPerformed methods) happens on a single thread - the "Event Dispatch Thread", or "EDT", …
Jump to PostThe first thing to do is get rid of the existing code in the
start.mouseClicked()
event handler. Those loops aren't working; you need something that will run each time theTimer
event fires. From here on in, all thatstart.mouseClicked()
will do is start theTimer
, and allstop.mouseClicked()
will …
Jump to PostThere are 2 thing that may help fix your problem. At least anyone of them is enough for the task.
1.Thread
2.javax swing Timer.1.if you need thread then you will need to call the runnable method to innitiate the clock. This must be called in an event.
- If you …
All 12 Replies
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
Ravish.Ahmad.Khan
0
Newbie Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
Ravish.Ahmad.Khan
0
Newbie Poster
Schol-R-LEA
1,446
Commie Mutant Traitor
Featured Poster
Ravish.Ahmad.Khan
0
Newbie Poster
Schol-R-LEA
1,446
Commie Mutant Traitor
Featured Poster
richieking
44
Master Poster
Schol-R-LEA
1,446
Commie Mutant Traitor
Featured Poster
Ravish.Ahmad.Khan
0
Newbie Poster
Ravish.Ahmad.Khan
0
Newbie Poster
Schol-R-LEA
1,446
Commie Mutant Traitor
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.