如何打印用户单击的按钮的字母,然后禁用该按钮
我使用 for 循环生成每个字母的按钮
} for (int i = 65; i <= 90; i++) {
btnLetters = new JButton(" " + (char) i);
letterJPanel.add(btnLetters);
letterJPanel.setLayout(new FlowLayout());
btnLetters.addActionListener(this);
}
单击按钮时,它应该打印字母,然后禁用按钮
public void actionPerformed(ActionEvent ae) {
if (ae.getSource() == btnLetters) {
}
}