Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我玩我的游戏时,我允许用户单击按钮,然后将 ao 或 x 设置为标签,然后每个按钮都处于活动状态,以不允许用户一次又一次地单击它
然而,当我到 9 点时,它是一个平局,弹出一个消息框并说平局,但我似乎无法让按钮恢复到原始状态以允许新一轮
你有什么建议
编辑:
我不知道为什么我没有创建一个循环来做这个干杯伙计们我会试试这个
当您没有向我们展示任何代码时,这当然很难,您尝试了什么不起作用?
我认为一个普通的旧循环应该可以解决问题。
JButton buttons[]; for(JButton b : buttons) { b.setText(""); b.setEnabled(true); }
我希望这是正确的循环语法,自从我使用 Java 以来已经有一段时间了。
按钮。setText("") , JComponent。设置启用(真)。