I would like to stop threads generated in the following manner by using jToggleButton. The threads are used for watching folders for files. I tried a lot, and searched alot,
There is a Thread.stop() method, but is has been deprecated, because it's unsafe.
Thread.stop()
Instead of using the deprecated method(s), you can modify some variable to indicate that the target thread should stop running.