Java – add timeout function to swingworker

I will have to implement some functions for my application soon, timeout according to the length specified by the user

I want to know if I can extend the swingworker class and add my own timeout countdown, for example, I can override the dowork method, call startCountdown (), and then call super.. Dowork then continues to check whether the timeout has exceeded?

I wonder if this method has a better solution? thank you

resolvent

Solution

Use swing timer?

If it goes out, the time is exceeded Cancel it before that to stop it

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>