如何在不更改 Netbeans 背景的情况下禁用 JButton
How to disable JButton without changing background on Netbeans
如何在不更改背景颜色的情况下禁用按钮。当我按下就绪时,就绪按钮和蓝色按钮被禁用。但我想保留蓝色按钮的颜色。
你可以帮帮我吗? On the left the blue button, on the right the disabled buttons
简单:保留一个实例变量 'isButtonEnabled',而不是启用或禁用按钮,而是更改此按钮的值。
那么,您需要做的就是:
public void actionPerformed(ActionEvent event){
if ( isButtonEnabled){
// the actual code
}
}
如何在不更改背景颜色的情况下禁用按钮。当我按下就绪时,就绪按钮和蓝色按钮被禁用。但我想保留蓝色按钮的颜色。 你可以帮帮我吗? On the left the blue button, on the right the disabled buttons
简单:保留一个实例变量 'isButtonEnabled',而不是启用或禁用按钮,而是更改此按钮的值。
那么,您需要做的就是:
public void actionPerformed(ActionEvent event){
if ( isButtonEnabled){
// the actual code
}
}