public void restoreBackGround() {

        for (int i = 0; i < 64; i++) {
            JPanel panel = (JPanel) chessBoard.getComponent(i);
            int row = (i / 8) % 2;
            if (row == 0) {
                panel.setBackground(i % 2 == 0 ? Color.black : Color.white);
            } else {
                panel.setBackground(i % 2 == 0 ? Color.white : Color.black);
            }
        }

    }