0

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;
    }
}
P-CHK
  • 1
  • 2
  • 2
    Please consider creating and posting a [mcve] that we all can run. – DontKnowMuchBut Getting Better Nov 18 '17 at 20:40
  • 2
    [This is an example of a card match/flipping game](https://stackoverflow.com/questions/16292498/swingworker-thread-sleep-or-javax-swing-timer-i-need-to-insert-a-pause/16293498#16293498) which demonstrates how to "show" cards for a period of time before they are returned to their "face down" position – MadProgrammer Nov 18 '17 at 21:59
  • One way to get image(s) for an example (as mentioned by @DontKnowMuchButGettingBetter) is to hot link to images seen in [this Q&A](http://stackoverflow.com/q/19209650/418556). – Andrew Thompson Nov 19 '17 at 01:49

0 Answers0