Resetting an array of JButton Labels and making all active again
Question
when i play my game i allow the user to click the buttons which then sets a o or an x as the label and then each button becomes in active as to not allow the user to clik it again and again
however when i get to 9 goes and its a draw a message box pops up and says draw but i cant seem to get the buttons to restore themselves to the original state to allow for a new round
what could you suggest
edit:
i have no idea why i didnt create a loop to do this cheers guys i will try this
Solution
This is of course hard when you didn't show us any code, what did you try that didn't work?
I would think a plain old loop should do the trick.
JButton buttons[];
for(JButton b : buttons)
{
b.setText("");
b.setEnabled(true);
}
I hope that is the proper looping syntax, it's been a while since I worked in Java.
OTHER TIPS
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow