in the code, you've created a separate
thread for longTask, but the task is
wrapped in a SwingUtilities.invokeLater, which brings it back into the EDT,
and causing the block.
here's the original class XYZ
note the longTask (the for loop) is performed within the separate thread,
then, at the end, updating the label is done in the EDT (by using SwingUtilities)
I've changed XYZ in this (also added a label to show the timer 'count'.
click the button, 1 second passes, timerLabel changes to 1
click the label, 1 second passes, timerLabel changes to 2, but the label
clicked doesn't change until the longTask finishes (5 seconds) - I also changed
this from a System.out.println() to a sleep delay (was causing thread deadlock on my pc)