I have a board with cards in which I have to find matches. I have two variables buttonA
and buttonB
to keep track of the squares clicked.
When they are equal I can remove them from the board by simply adding this code:
cards[buttonA].setVisible(false);
cards[buttonB].setVisible(false);
How can I place the same image on all the buttons after finding matches? I tried the following but it instead of changing the image simply leaves the same image on the buttons
cards[buttonA].setIcon(new ImageIcon("myPic.png");