java - How do I run a thread on JButton? - Stack
2021-2-13 · It's better to use a thread pool (e.g., via an ExecutorService, or by using a SwingWorker) because creating and destroying Thread objects is expensive. In this case, no harm is done because the system can create and destroy Threads faster than the user can click the button, but even so, it's a bad habit to go 'round calling new Thread for short-lived tasks.
Get Price