Hey all,
alright I know this sounds a little far-fetched, but let me explain. I created 26 JButtons in an anonymous actionListener labeled as each letter of the alphabet.
for (int i = 65; i < 91; i++){
final char c = (char)i;
final JButton button = new JButton("" + c);
alphabetPanel.add(button);
button.addActionListener(
new ActionListener () {
public void actionPerformed(ActionEvent e) {
letterGuessed( c );
alphabetPanel.remove(button);
}
});
// set the name of the button
button.setName(c + "");
}
Now I have an anonymous keylistener class, where I would like to disable the button based off of which letter was pressed on the keyboard. So if the user presses A, then the A button is disabled. Is this even possible given my current implementation?
Thanks in advance,
Tomek