private void formMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_formMouseClicked

        if ( this.card != null && !this.card.isMatched() && this.card.isPlayable() ) {

            // Set the clicked card as selected.
            game.setSelected(game.selectCard(this.card));

            // Check if there is already another card selected
            if ( game.getSelectedCard1() != null && game.getSelectedCard2() != null ) {

                // Check the selected cards create a match
                if ( game.checkMatch(game.getSelectedCard1(), game.getSelectedCard2()) ) {

                    // Get the current instance of the GUI.
                    GUI thisGui = (GUI) SwingUtilities.windowForComponent(this);
                    // Update the GUI to remove matched cards.
                    thisGui.drawCardGrid();

                }

                // Clear the highlight on the card.
                if ( GUI.selected != null ) {
                    GUI.selected.deselect();
                }

            } else {
                // Sets this card as the selected one and sets higlighting on.
                GUI.selected = this;
                this.setHighlighted();
            }
        }

        game.notifyObservers();
    }//GEN-LAST:event_formMouseClicked