views:

698

answers:

1

I'm working on a memory game program. I have 30 JButtons on a JPanel. When the user is clicking and finds a match (meaning two buttons with the same image) I want to change the image on the JButton to a different image. However this does not happen while the program is running.

How can I do this?

I was doing this:

cards[i].setIcon(cardBack);

where cardBack is an ImageIcon that I already have.

+1  A: 

Looks a lot like this question

oxbow_lakes
Ahh yeap. Exact duplicate. Uhmm. I drop my closing vote powers :( Feels odd.
OscarRyz
I thought I'd seen something like this recently.
Michael Myers