Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect when main thread freeze GUI in java?

I want to detect when some time consumption operations in main thread cause gui freeze. My target is to set and unset wait cursor automatically.

thanks

like image 823
blow Avatar asked Feb 16 '26 06:02

blow


1 Answers

I think you're putting the cart before the horse: Your main thread shouldn't do any time-consuming operations in the first place - they should always be externalized in separate threads, so that your GUI can stay responsive (and e.g. show status on the operations, or provide the possibility to abort them).

like image 85
codeling Avatar answered Feb 17 '26 18:02

codeling



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!