I'm working on this portfolio project where java displays an array being sorted in real time.
On feature I want to add is a "reset" button that tells the app to stop sorting an array.
But I got seriously stuck and I think I'm going about this ALL WRONG.
I have two classes that I'm trying to implement this feature with.
AnimationUnit class and SortingAlgorithm class that has a "sortList" method.
What I was trying to do was store the thread that's sorting the array into a variable.
Then using a "reset()" method, call the "interrupt()" on the Thread object when I want to.
The sortList() method periodically checks the interrupt flag and throws an InterruptedException if it is interrupted.
But when I call the reset(), the sorting thread still seems to be alive because It's still sending updated to the GUI display.
Has anyone tried implementing something like this before?