开发者

Java Socket prevents panel?

开发者 https://www.devze.com 2023-03-28 04:12 出处:网络
I am trying to create a panel while I have already connected to a server with socket, but in java it shows frame but not inside of frame. Panel is only shown after socket closed, but I need it while i

I am trying to create a panel while I have already connected to a server with socket, but in java it shows frame but not inside of frame. Panel is only shown after socket closed, but I need it while it is open. How can I solve this? It is because of a thread prob开发者_高级运维lem or I just missing something.... Thanks...


Long-running tasks should never occur on the EDT. This includes blocking I/O operations. If such tasks do not modify any Swing components, simply use another thread. Otherwise, there are utilities available (e.g. SwingWorker and SwingUtilties) that will enable to you carry out long-running tasks in another thread, and then post the result as an action event on the EDT to modify any Swing components.

See also:

  • Concurrency in Swing
0

精彩评论

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