I am creating a match game and I need to flip between two side of card. So, I used enable and disable. I would like they to flip to front before they disappear or disable just like before, but it just disappear or just don't do anything. I have set my disabledicon.
public void mouseReleased(MouseEvent e)
{
System.out.println(counter);
for(int i = 0; i<=9;i=i+1)
{
if (e.getSource()==photos[i] )
{
if(!photos[i].isEnabled()){
photos[i].setEnabled(true);
}else{
System.out.println(photos[i]);
photos[i].setEnabled(false);
System.out.println(photos[i]);
}
if(counter==1)
{
firstone = photos[i];
}
if(counter==2)
{
System.out.println(firstone);
System.out.println(photos[i]);
if(firstone.getIcon().toString().equals(photos[i].getIcon().toString()))
{
photos[i].setEnabled(true);
}
}
}
}
counter = counter+1;
if(counter==3)
{
counter =1;
}
}