如何解压jButton? [英] How to unpress a jButton?
本文介绍了如何解压jButton?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个调用函数的jButton.此功能最多可能需要一分钟才能完成.在此期间,jButton保持按下状态.有没有办法解开jButton?
我尝试过
jButton.setEnabled(true);
jButton.setEnabled(false);
但是这些似乎没有帮助.
解决方案
不要在GUI线程中进行任何处理.改用 SwingWorker
.. >
I have a jButton that calls a function. This function can take up to a minute to complete. During this time the jButton stays pressed. Is there a way to unpress the jButton?
I have tried
jButton.setEnabled(true);
jButton.setEnabled(false);
but these do not seem to help.
解决方案
Don't do the minute of processing in the GUI thread. Use a SwingWorker
instead.
这篇关于如何解压jButton?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文