java applet 按钮,JButton“保持按下”状态在Java Applet中单击后

该篇博客讲述了如何在Java Applet中使用后台线程处理ACTION_LISTENER的大量操作,以解决用户点击按钮后按钮长时间“按住”问题,提高用户体验。作者建议将密集任务转移至非主线程执行,以实现即时响应。
摘要由CSDN通过智能技术生成

I have a JButton in my Java Applet. After pressing it, ActionListener have to make huge amount of actions. So, because of it, when user clicks the button, it "stay pressed" for a while (sometimes even 5 minuts) instead of disable itself immidiately (it disable itself after these 5 minuts).

public void actionPerformed(ActionEvent e) {

JButton.setEnabled(false);

//...

}

I don't want user to see that. I would like all these action execute in the background. What can I do to achive it?

解决方案

You should do such intensive tasks in another thread, not the dispatcher thread.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值