手动使JButton保持按下状态 [英] Making a JButton stay depressed manually

查看:61
本文介绍了手动使JButton保持按下状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让JButton保持按下状态,直到某些事件发生之前不能再次按下它,是否有一种简单的方法来做到这一点?

I would like to make a JButton stay pressed down and not be able to be pressed again until some event occurs is there an easy way to do this?

推荐答案

也许您只是想禁用该按钮?尝试在按钮的回调中输入setEnabled(false).

Perhaps you just want to disable the button? Try setEnabled(false) in your callback for the button.

这篇关于手动使JButton保持按下状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆