开发者社区 问答 正文

JButton按钮无法禁用按钮

JButton按钮无法禁用按钮,代码如下

  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);

展开
收起
蛮大人123 2016-03-12 18:50:57 2887 分享 版权
1 条回答
写回答
取消 提交回答
  • 我说我不帅他们就打我,还说我虚伪

    一个问题是false写成了fasle;
    一个是this.add(this.panal)是不是应该改成this.add(this.button);

    2019-07-17 19:01:27
    赞同 展开评论
问答地址: