Why is it not saying I won?
- by Itachi
This is my if statement...
The buttons show up like this:
This is my if statement
if((buttons[3].getName()=="x" && buttons[6].getName()=="x" &&
buttons[9].getText()=="x")||(buttons[2].getName()=="x" &&
buttons[5].getName()=="x" && buttons[8].getName()=="x")||
((buttons[1].getName()=="x") && (buttons[4].getName()=="x") &&
(buttons[7].getName()=="x"))){
JOptionPane.showMessageDialog(null,"X Wins");
}
So if I select the 1st, 4th and 7th buttons (the left most 3 buttons) why does it not say "X Wins"?
As a sidenote, yes the buttons should have the name "x"