this.button = new JButton(Img);
//设置按钮位置
this.button.setBounds(x, y, w, h);
//增加事件监听(内部匿名类),使得按完按钮后按钮被禁用
this.button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
this.button.setEnable(fasle);
}
});
this.add(this.panal);
JButton按钮无法禁用按钮,代码如下
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
5条回答 默认 最新
JonsonJiao 2015-06-03 13:21关注一个问题是false写成了fasle;
一个是this.add(this.panal)是不是应该改成this.add(this.button);本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报