开发者

java swing form hang

开发者 https://www.devze.com 2023-02-12 20:57 出处:网络
I am developing an 开发者_如何学Capplication in java Swing(desktop) that communicate to device through Serial port.the problem is that it hangs when communication lost with device.and I am unable to c

I am developing an 开发者_如何学Capplication in java Swing(desktop) that communicate to device through Serial port.the problem is that it hangs when communication lost with device.and I am unable to close the Form until I don't end the .exe in window task mannager.what should be solution so that i can close the forms.


I'm guessing you are communicating with the other application by using the Event Dispatch Thread. If the other application hangs then your GUI becomes unresponsive.

I would suggest you use a separate Thread to communicate with the other device.

Read the section from the Swing tutorial on Concurrency for more information.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号