/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


import java.awt.Color;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JButton;


/**
 *
 * @author Francisco Matesanz & Benjamin Nogal
 */
public class listenerResetGame implements MouseListener {

    final slot[][] board;
    final JButton[][] button;
    final boolean[][][] errorBoard;

    /**
     *
     * @param button
     * @param board
     * @param errorBoard
     */
    public listenerResetGame(JButton[][] button, slot[][] board, boolean[][][] errorBoard) {
        this.board = board;
        this.button = button;
        this.errorBoard = errorBoard;
    }

    public void mouseClicked(MouseEvent e) {
    }

    public void mousePressed(MouseEvent e) {
        resetSudoku();
    }

    public void mouseReleased(MouseEvent e) {
    }

    public void mouseEntered(MouseEvent e) {
    }

    public void mouseExited(MouseEvent e) {
    }
    private void resetSudoku(){
        for(int x=0;x<9;x++){
            for(int z=0;z<9;z++){
                if(board[x][z].aviable){
                    board[x][z].value=0;
                    button[x][z].setText("X");
                    errorBoard[x][z][0] = false;
                    errorBoard[x][z][1] = false;
                    errorBoard[x][z][2] = false;
                    if(((x<3)&&(z<3))||(x>5)&&(z<3)||((x<3)&&(z>5))||
                    		((x>5)&&(z>5))||(((x>2)&&(x<6))&&((z>2)&&(z<6)))                        )
                       button[x][z].setBackground(Color.CYAN);
                    else
                        button[x][z].setBackground(Color.BLUE);
                    
                }
                else
                	button[x][z].setBackground(Color.GRAY);
            }
        }
    }
    

}

