Example #1
0
 /**
  * method that will be called when mouse releases
  * @param point , the point mouse release at
  */
 public void onMouseRelease(Location point) {
   isGrabbed = false;
   if(!success){
     for(Piece p: bp){
     
       //if correctly matched
       if(p.contains(grabbedPiece.getCenter()) &&
           p.equals(grabbedPiece)){
         grabbedPiece.hide();
         p.show();
         p.showHighlight(Color.GREEN);
         lockedBP[p.getId()] = true;
       
         //check if all pieces are matched
         boolean check = true;
         for(boolean b: lockedBP){
           check = check && b;
         }
         if(check){
           success = true;
           for(Piece piece: bp){
             piece.hideHighlight();
           }
           text.show();
         }
       }
     }
   }
 }