Good morning !
I m new to Java ,but I believe this question about thread organisation in my program ..Can you please help me to optimize it ?
Program has to do count time and show it on display and at the same time play appropriate sound (frequency of sound is taken from array freq
.When i m trying to run program it produced appropriate sounds ,but timer slows down and count time with delays up to 10 seconds ...
What should i do ?
Thank you very much
Here is code
I would rewrite that code using Swing components, and use a Swing timer to do the repetitive screen updates. There's really no reason to use the old AWT components since Swing replaced them nearly 15 years ago, and trying to get multiple threads working with the old AWT components is also a dead subject.
It's possible that just replacing your infinite loop by a Swing timer might solve your problem, but really I wouldn't continue with those antique AWT components.