简体   繁体   English

使用JMS的GUI中的Java线程

[英]Java threads in GUI with JMS

I am trying send messages with JMS in GUI Swing. 我正在尝试在GUI Swing中使用JMS发送消息。 When I make thread for JMS so Swing freeze, but messages are sending correct (by JBOSS logging) but it is unusable. 当我为JMS创建线程时,Swing冻结,但是消息发送正确(通过JBOSS日志记录),但是它不可用。 I need setting some parameters to Chat object from Swing. 我需要为Swing中的Chat对象设置一些参数。 How I can make instance of Chat class (with JMS methods) in Swing running independently on Swing and with cooperate? 我如何才能使Swing中的Chat类实例(使用JMS方法)在Swing上独立运行并与之协作?

You are blocking the Event Dispatch Thread so Swing freezes. 您正在阻止事件调度线程,因此Swing冻结。 Read the section from the Swing tutorial on Concurrency in Swing for more information. 阅读Swing教程中有关Swing中的并发性的部分,以获取更多信息。

As already recommended you should probably use a SwingWorker , which is discussed in the tutorial. 正如已经建议的那样,您可能应该使用SwingWorker ,本教程对此进行了讨论。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM