【发布时间】:2012-11-21 06:24:20
【问题描述】:
我使用 NetBeans 创建了一个框架。框架有两个按钮 A 和 B。按钮 A 最初是禁用的。仅在单击按钮 B 时启用。
public newFrame() { //newFrame is the name of the frame that has buttons A&B
initComponents();
btn_A.disable();
}
private void btn_BActionPerformed(java.awt.event.ActionEvent evt)
{
btn_A.enable();
}
问题是,当鼠标移到按钮 A 上时,按钮 A 变为活动/启用,即不管按钮 B 是否被单击。我该如何解决这个问题?
我希望仅在单击按钮 B 后才启用按钮 A,而不是由于任何其他事件。
【问题讨论】:
标签: java swing netbeans jbutton