Hi everyone!
So in my latest application, I have my main JFrame window and a background worker
thread. When you click the 'Start' button on the main window, it starts the background worker thread and also sets a java.util.Timer using:
The timer's job is to increment a milliseconds variable to keep track of exactly how long the background thread takes to execute and also provide a time stamp relative to the start time for when the background thread prints to the log. The problem I am running into is the timer seems to not be calling the TimerTask (IncrementTime extends TimerTask) object's run method. If I set the delay parameter to 0, the run() method gets called once, but never again.
I create the timer object as a public field in my main window's (extending JFrame) class code using:
Here's all the possibly relevant code from the 'Start' button click event:
sendStopSignal(boolean stop) is a method I wrote into my AnalyzerProcess() class to gracefully and cleanly stop its current activity and then end the thread's execution.
The last thing the worker thread does before it finishes it's execution is call this method on the JFrame:
Here's my TimerTask extension class:
The System.out.println() never gets called.
This may be unnecessary, but just for completeness, here is my IncrementTime() method:
If you need any other info please let me know. Thank you so much in advance for your help! You guys here are all super awesome!